Loading two different Tensorflow versions with different classloaders
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- java, tensorflow
- Domain
- machine-learning
Research direction
The issue names no repository file, test, or entry point. Start by tracing TensorFlow Java's native library loading and classloader handling, then reproduce the sequential loading of two TensorFlow versions using the reported variant-op registration failure. Done means documenting whether unloading is supported and identifying a validated way to load versions separately, if one exists.
Written by the indexing model from the issue text.
Description
Hello, I am creating a program that makes inference with already trained models and I want to allow changing the tensorflow versions on runtime. For that I am loading dynamically the JARS needed to run Inference with TF Java in a separate classloader. These JARs are not in the classpath of the main program. I expected that when the ClassLoader is garbage collected, the native libraries loaded by that classloader were going to be unloaded too. However that is not the case and I am not able to load two different versions of Tensorflow in the same run time one after the other. The error I get when I try to execute a command with the JARs corresponding to the second TF version loaded is :
2021-12-21 14:47:11.121313: F external/org_tensorflow/tensorflow/core/framework/variant_op_registry.cc:46] Check failed: existing == nullptr (0x7ff35a2acc38 vs. nullptr)Unary VariantDecodeFn for type_name: tensorflow::data::WrappedDatasetVariant already registered
Is this behaviour expected? Is there any way I can do what I want?
regards,
Carlos
- Dominant language
- Java
- Stars
- 928
- Forks
- 227
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tensorflow/java
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
tensorflow/java#653 · 1 comment · 4 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
tensorflow/java#621 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
tensorflow/java#617 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
tensorflow/java#615 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
tensorflow/java#614 · 1 comment ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100