Running two models with same engine at once
See original GitHub issueDescription
Cannot run two models in NiFi 1.11.4 if both using Pytorch engine.
Expected Behavior
Both should be able to use the library
Error Message
java.lang.UnsatisfiedLinkError: /Users/tspann/.djl.ai/pytorch/1.6.0-cpu-osx-x86_64/0.8.0-SNAPSHOT-cpu-libdjl_torch.dylib (Library is already loaded in another ClassLoader)
How to Reproduce?
https://github.com/tspannhw/nifi-djlsentimentanalysis-processor
Steps to reproduce
(Paste the commands you ran that produced the error.)
- install NiFi nars for both models
- run at same time
What have you tried to solve it?
- Tweaked poms
- Tried different engines, but that’s a stop gap and I want Pytorch for both Bert QA and Sentiment.
Environment Info
Run my nifi processors https://github.com/tspannhw/nifi-djlqa-processor https://github.com/tspannhw/nifi-djlsentimentanalysis-processor
java.lang.UnsatisfiedLinkError: /Users/tspann/.djl.ai/pytorch/1.6.0-cpu-osx-x86_64/0.8.0-SNAPSHOT-cpu-libdjl_torch.dylib (Library is already loaded in another ClassLoader)
at java.base/java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1742)
at java.base/java.lang.System.load(System.java:585)
at ai.djl.pytorch.jni.LibUtils.loadLibrary(LibUtils.java:83)
at ai.djl.pytorch.engine.PtEngine.newInstance(PtEngine.java:42)
at ai.djl.pytorch.engine.PtEngineProvider.getEngine(PtEngineProvider.java:27)
at ai.djl.engine.Engine.initEngine(Engine.java:49)
at ai.djl.engine.Engine.<clinit>(Engine.java:44)
at ai.djl.repository.zoo.BaseModelLoader.loadModel(BaseModelLoader.java:129)
at ai.djl.repository.zoo.ModelZoo.loadModel(ModelZoo.java:162)
at com.dataflowdeveloper.djlsentimentanalysis.SentimentAnalysisService.predict(SentimentAnalysisService.java:69)
at com.dataflowdeveloper.djlsentimentanalysis.DeepLearningSAProcessor.onTrigger(DeepLearningSAProcessor.java:95)
at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1176)
at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:836)
2020-09-29 10:51:29,147 WARN [Timer-Driven Process Thread-6] ai.djl.engine.Engine Failed to load engine from: ai.djl.pytorch.engine.PtEngineProvider
2020-09-29 10:51:29,147 ERROR [Timer-Driven Process Thread-6] c.d.d.DeepLearningSAProcessor DeepLearningSAProcessor[id=8e70f82b-0174-1000-396b-9febdfca9935] Unable to process Deep Learning Sentiment Analysis DL No matching model with specified Input/Output type found.
2020-09-29 10:51:29,152 ERROR [Timer-Driven Process Thread-6] c.d.d.DeepLearningSAProcessor DeepLearningSAProcessor[id=8e70f82b-0174-1000-396b-9febdfca9935] DeepLearningSAProcessor[id=8e70f82b-0174-1000-396b-9febdfca9935] failed to process due to ai.djl.repository.zoo.ModelNotFoundException: No matching model with specified Input/Output type found.; rolling back session: ai.djl.repository.zoo.ModelNotFoundException: No matching model with specified Input/Output type found.
ai.djl.repository.zoo.ModelNotFoundException: No matching model with specified Input/Output type found.
at ai.djl.repository.zoo.ModelZoo.loadModel(ModelZoo.java:173)
at com.dataflowdeveloper.djlsentimentanalysis.SentimentAnalysisService.predict(SentimentAnalysisService.java:69)
at com.dataflowdeveloper.djlsentimentanalysis.DeepLearningSAProcessor.onTrigger(DeepLearningSAProcessor.java:95)
at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1176)
at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Running two models with same engine at once #179 - GitHub
Merge the two model processors into the one, and you will implement how you use different DJL models in the processor. We recommend...
Read more >Deepstream run multiple model engines concurrently
Hello, could I know if it is possible to run on deepstream, multiple model engines (yolo) simultaneously on one source video and produce...
Read more >Can You Run Two Model Trains on the Same Track?
You can run two model trains on the same track using either the DC or the DCC control system. DC is recommended on...
Read more >Can I run multiple deep learning models on the same GPU?
Yes, one can use multiple heterogeneous machines including CPU, GPU and TPU using an advanced framework like tensorflow. Training a model in a...
Read more >Keras Running Inference with Multiple Models' at once
I'm training models with a genetic algorithm, and the fitness function first builds the model with certain parameters, and then runs ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@stu1130 Please take a look.
thanks