Skip to content

Commit f7e2908

Browse files
committed
correct error sending model source to other process
1 parent a36db59 commit f7e2908

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/io/bioimage/modelrunner/pytorch/JavaWorker.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private void executeScript(String script, Map<String, Object> inputs) {
8787
this.reportLaunch();
8888
try {
8989
if (script.equals("loadModel")) {
90-
pi.loadModel((String) inputs.get("modelFolder"), null);
90+
pi.loadModel((String) inputs.get("modelFolder"), (String) inputs.get("modelSource"));
9191
} else if (script.equals("inference")) {
9292
pi.runFromShmas((List<String>) inputs.get("inputs"), (List<String>) inputs.get("outputs"));
9393
} else if (script.equals("close")) {

src/main/java/io/bioimage/modelrunner/pytorch/PytorchInterface.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public class PytorchInterface implements DeepLearningEngineInterface {
100100
*/
101101
private ZooModel<NDList, NDList> model;
102102

103+
private String modelFolder;
104+
103105
private String modelSource;
104106

105107
private boolean interprocessing = true;
@@ -155,6 +157,7 @@ private Service getRunner() throws IOException, URISyntaxException {
155157
public void loadModel(String modelFolder, String modelSource)
156158
throws LoadModelException
157159
{
160+
this.modelFolder = modelFolder;
158161
this.modelSource = modelSource;
159162
if (interprocessing) {
160163
try {
@@ -188,7 +191,8 @@ public void loadModel(String modelFolder, String modelSource)
188191

189192
private void launchModelLoadOnProcess() throws IOException, InterruptedException {
190193
HashMap<String, Object> args = new HashMap<String, Object>();
191-
args.put("modelFolder", modelSource);
194+
args.put("modelFolder", modelFolder);
195+
args.put("modelSource", modelSource);
192196
Task task = runner.task("loadModel", args);
193197
task.waitFor();
194198
if (task.status == TaskStatus.CANCELED)

0 commit comments

Comments
 (0)