Skip to content
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

Questions about design goals, roadmap, PyTorch integration, DL4j, etc. #69

Open
mkaze opened this issue May 24, 2021 · 3 comments
Open
Assignees
Labels
question Further information is requested

Comments

@mkaze
Copy link
Contributor

mkaze commented May 24, 2021

I am currently learning Kotlin and in order to enhance my learning experience I was looking for a project accepting contributions. So I am excited to find this library, especially considering the fact that I have a relatively fair amount of experience working with Keras/TF in Python. However, I have a few questions about some of the high-level aspects of the project and I would appreciate if the maintainers could answer them:

  • Is the goal to mimic the Python API of Keras as close as possible, or instead, should it focus on "what's the idiomatic way to implement XYZ feature in Kotlin?" regardless of how the that feature has been implemented in Python API of Keras (i.e. kotlinic vs. pythonic)? As I see, currently there is a rather strong focus to follow Keras API.
  • What's the plan for switching to TF 2+ Java APIs?
  • Is TF the only backend to be supported, or is there a plan to add support for more backends (e.g. PyTorch)?
  • How is this going to differ from Deeplearning4J?
  • Is there a long-term goal to get rid of the backend(s) in future and replace them with Kotlin implementations and libraries (i.e. similar to what DL4J has done, though from the beginning)?

Thanks!

@zaleslaw zaleslaw added the question Further information is requested label May 24, 2021
@zaleslaw
Copy link
Collaborator

zaleslaw commented May 25, 2021

Great questions; I'll try to answer all of them.

I am currently learning Kotlin, and to enhance my learning experience, I was looking for a project accepting contributions. So I am excited to find this library, especially because I have a relatively fair amount of experience working with Keras/TF in Python. However, I have a few questions about some of the high-level aspects of the project, and I would appreciate it if the maintainers could answer them:

  • Is the goal to mimic the Python API of Keras as close as possible, or instead, should it focus on "what's the idiomatic way to implement XYZ feature in Kotlin?" regardless of how the that feature has been implemented in Python API of Keras (i.e. kotlinic vs. pythonic)? As I see, currently there is a rather strong focus to follow Keras API.

The project is started as a copy of Keras at the top of TensorFlow, and Keras is the most popular high-level framework in DL at this moment (top-level frameworks based on PyTorch are not so popular)

Also, it supports the transfer learning on Keras models, and we need to be fully compatible with it (it has the same layers with the same inputs and outputs, and so on).

But we started the experiment with KotlinDSL for preprocessing. We will design an alternative API for the building NN as a graph (I suppose it will be an open design doc, and I'll share it here in this issue and discussion chapter.

But it will be not limited to Keras API only; we think it will be extended to have customizable parts and training cycle like in PyTorch.

  • What's the plan for switching to TF 2+ Java APIs?

TF Java API 2.x is a low-level API under development. The team is great and project too, but.

It has no advantages at this moment for switching:

  • not so many new ops
  • no performance speedup
  • possible memory leak
  • unstable and experimental API
  • we could load TF 2.x models written in Keras

Resume: we switch on TF Java API 2.x if it will be more stable and a few critical issues will be solved

  • Is TF the only backend to be supported, or is there a plan to add support for more backends (e.g., PyTorch)?

Fully answered here

  • How is this going to differ from Deeplearning4J?

DL4j is a great project, and we have no goal to repeat it or rewrite it from scratch.
Correct me if I'm wrong about the idea of DL4j to have its own runtime and integrations with other DL frameworks.
We will not write our own runtime, no chance to do it better than TF or Torch teams.

Our idea to cover main and popular cases for production, data engineers and be a good entry point for students.
This is well described in the presentation "Deep Learning with KotlinDL"

  • Is there a long-term goal to get rid of the backend(s) in the future and replace them with Kotlin implementations and libraries (i.e. similar to what DL4J has done, though from the beginning)?

There is a few NumPy-like libraries in the Kotlin ecosystem: multik and viktor,

We will use Multik to build inference or maybe transfer learning in Kotlin for mobile devices. Still, as I mentioned earlier, we have no goal to build and maintain our own Tensor library from scratch, with a high probability it will be wrappers for TF or PyTorch.

Thanks!
Thank you for your questions

So, if you have any ideas about Kotlin idiomatic stuff related to NN or data preprocessing, I invite you to collaborate here or in the discussion chapter.

@zaleslaw zaleslaw changed the title Questions about design goals, roadmap, etc. Questions about design goals, roadmap, PyTorch integration, DL4j, etc. May 25, 2021
@mkaze
Copy link
Contributor Author

mkaze commented May 26, 2021

@zaleslaw Thanks a lot for your comments. That makes it clearer now.
One more question: I am not familiar with TF Java API, and I was wondering if you see any advantage in writing a Kotlin API for TF (probably as a separate project and a long-term goal)?

So, if you have any ideas about Kotlin idiomatic stuff related to NN or data preprocessing, I invite you to collaborate here or in the discussion chapter.

Sure! Although, as I mentioned earlier, I am new to Kotlin and I am still learning it and studying the codebase to understand what's going on. Anyways, I'll try to work on some of the "good first issues" and also share my ideas. Thanks again!

@zaleslaw
Copy link
Collaborator

Currently, Kotlin API for low-level operands have a chance to become a part of tensorflow/java project (it has a draft PR), if it will be mature and useful, we will not create yet one, if it will be frozen or unfinished, so, Kotlin API for low-level TF should be created too (maybe as a separate module in this project)

@zaleslaw zaleslaw self-assigned this Jun 15, 2021
@zaleslaw zaleslaw added this to the 0.4 milestone Sep 13, 2021
@zaleslaw zaleslaw removed this from the 0.4 milestone Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants