-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I use DJL NDArrays without a engine? #222
Comments
They can't. The basic design of DJL is that the things in the main API module like The goal of this is that different engines can have different implementations. We could have an interface built entirely in Java to work with GC. We could have an interface built in C++ if it is faster. We could have smaller ones that are CPU only or bigger ones with GPU. And, they could also have only NDArray code or all kinds of deep learning operations implemented. |
And for example, should I be able to create an NDArray with the python engine? Ive seen that the full support is only for Pytorch mxnet and Tf |
It depends on the engine, because we have a few different groups of them. There are ones like PT, MX, and TF which are full engines that support all of deep learning and NDArrays. Although, for TF some of that support hasn't been fully implemented on the DJL side. Then, we could have engines that are NDArrays without deep learning. For example, we might have a numpy engine or a cupy engine. These would probably be smaller and simpler that the full DL engines, but still great for the NDArray parts of the API. Finally, we have ones that are basically Predictor only. This is what we do with something like XGBoost which is really more ML than DL, but we want to still be able to run it with DJL Serving or using the same DJL model zoo. I think the plan was that the Python engine would fall into this group |
should I be able to create an NDArray simply with the API and the Python engine jars? Also, are the latest APIs (0.13.0, 0.14.0, 0.15.0 and 0.16.0) supported by Java 8? Thanks a lot for your help. |
The Python engine jar does not have any NDArray support inside it. It is just Predictor only. If you want NDArray operations, only MX and PT fully implement the DJL NDArray API. There might be others in the future, but those are the ones right now All of our latest versions should support Java8. |
Thanks for the answer. And finally, is it possible to run several engines on the same machine. I have found that as the initialization of engines only takes place whenever the first engine is loaded. If the classes corresponding to the next engine are added dinamically, the new engine never enters the ALL_ENGINES variable of the engine class |
If you know all of the engines you want, then you can add all of them to the classpath and it is fine having multiple engines in the classpath. If you are trying to dynamically add engines into the classpath, you can use |
We created a Java engine (was used for testing purpose) that you can achieve what you want. You can only create NDArrays but you cannot run any operators. You just need to include it in your classpath. See: https://github.com/deepjavalibrary/djl-serving/tree/master/engines/java. |
Hello, thanks for you help. Is this engine available on maven, I have just seen it on nexus as a snaptshot module, not .jar file. |
I have just tried this simple piece of code:
only with the dependency
from repository:
and I got the error saying that no engine was found.
Do I need another dependency or am I missing something? |
Hello it's me again
Can I go on and keep using this engine or is there any issue? |
@carlosuc3m The Java engine we created is purely for testing purpose to create NDArray without depending on a full engine like PyTorch. |
Yess, but I have tried the Python engine, and it also works. |
@carlosuc3m |
Feel free to reopen the issue if you still have questions. |
Hello I am tryng to use the NDArrays as the backbone of my program. They are quite convenient and I am using them almost as Numpy arrays. However, I have notices that they have to be used together with one of the djl engines. Is it possible to use NDArrays without having to use any of the engines as a edpendency?
REgards,
Carlos
The text was updated successfully, but these errors were encountered: