deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.07k stars 649 forks source link

Add a ND4J backend #2

Open wmeddie opened 4 years ago

wmeddie commented 4 years ago

Description

ND4J, the accelerated linear algebra backend that powers Eclipse DeepLearning4J, should have all the necessary features to become a proper backend for DJL.

Will this change the current api? How?

No API changes should be necessary for the basics. If ND4J provides any opportunity an API enhancement we can discuss those as a separate issue.

Who will benefit from this feature?

DL4J has support for more native architectures (including ARM64 (Raspberry Pi/iOS/Android) and OpenPower) so it will allow people with those devices to take advantage of DJL. DL4J supports importing Keras, Tensorflow and ONNX models so if we design this correctly we can expand the types of pre-trained models the users can use.

References

lanking520 commented 4 years ago

Wow, that's great! Thanks for your interest in DJL. Hope to see your contribution soon :).

Recommendation:

  1. Please work carefully on the NDManager because that is the most effective layer to collect memory.
  2. The NDArray behavior may change through time since we are actively adding more ops into DJL.
shilan commented 4 years ago

Does this mean that it will also work in windows? I became really disappointed when I tried to build examples on my windows machine and I realized that it is impossible. And then probably I cannot use the entire library on my windows pc :( is there a way to go around this?

lanking520 commented 4 years ago

Does this mean that it will also work in windows? I became really disappointed when I tried to build examples on my windows machine and I realized that it is impossible. And then probably I cannot use the entire library on my windows pc :( is there a way to go around this?

Currently, Windows is WIP. We will try to get there once we have MXNet 1.6 for Windows (MXNet Engine). For now, you can use docker to host it on Windows.

wmeddie commented 4 years ago

I also used WSL to build which works fine for CPU at least.

ND4J does work (and pretty much has always worked) on Windows so given that enough of the operations are added it could in theory be used. MXNet 1.6 might come out sooner though not sure on the timeline of that.

shilan commented 4 years ago

I also used WSL to build which works fine for CPU at least.

great idea! never thought about that. However, I have never worked WSL before, hopefully it is straight forward to use :)

frankfliu commented 4 years ago

@shilan You can try latest code now, it should work on Windows for both CPU/GPU now. Please notes windows support is still WIP, and only support limited cuda arch (sm_37, sm_70).

goswamig commented 3 years ago

@shilan did you get a chance to try out latest code ?