question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running two models with same engine at once

See original GitHub issue

Description

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.)

  1. install NiFi nars for both models
  2. run at same time

What have you tried to solve it?

  1. Tweaked poms
  2. 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:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
frankfliucommented, Sep 29, 2020

@stu1130 Please take a look.

0reactions
tspannhwcommented, Oct 30, 2020

thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found