Skip to content

Commit

Permalink
correct couple of silly errors
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Sep 24, 2024
1 parent 453786d commit 5a5fe33
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,17 @@ private void unzipTfWeights(ModelDescriptor descriptor) throws LoadModelExceptio
String source = descriptor.getWeights().gettAllSupportedWeightObjects().stream()
.filter(ww -> ww.getFramework().equals(EngineInfo.getBioimageioTfKey()))
.findFirst().get().getSource();
source = DownloadModel.getFileNameFromURLString(source);
System.out.println("Unzipping model...");
ZipUtils.unzipFolder(modelFolder + File.separator + source, modelFolder);
if (new File(source).isFile()) {
System.out.println("Unzipping model...");
ZipUtils.unzipFolder(new File(source).getAbsolutePath(), modelFolder);
} else if (new File(modelFolder, source).isFile()) {
System.out.println("Unzipping model...");
ZipUtils.unzipFolder(new File(modelFolder, source).getAbsolutePath(), modelFolder);
} else {
source = DownloadModel.getFileNameFromURLString(source);
System.out.println("Unzipping model...");
ZipUtils.unzipFolder(modelFolder + File.separator + source, modelFolder);
}
} else {
throw new LoadModelException("No model file was found in the model folder");
}
Expand All @@ -258,15 +266,15 @@ void run(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTensors)
List<String> inputListNames = new ArrayList<String>();
List<TType> inTensors = new ArrayList<TType>();
int c = 0;
for (Tensor<?> tt : inputTensors) {
for (Tensor<T> tt : inputTensors) {
inputListNames.add(tt.getName());
TType inT = TensorBuilder.build(tt);
inTensors.add(inT);
String inputName = getModelInputName(tt.getName(), c ++);
runner.feed(inputName, inT);
}
c = 0;
for (Tensor<?> tt : outputTensors)
for (Tensor<R> tt : outputTensors)
runner = runner.fetch(getModelOutputName(tt.getName(), c ++));
// Run runner
List<org.tensorflow.Tensor> resultPatchTensors = runner.run();
Expand Down

0 comments on commit 5a5fe33

Please sign in to comment.