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

Plan #1

Open
17 tasks
ankane opened this issue Nov 26, 2019 · 13 comments
Open
17 tasks

Plan #1

ankane opened this issue Nov 26, 2019 · 13 comments

Comments

@ankane
Copy link
Owner

ankane commented Nov 26, 2019

Next

  • add num_workers option to data loader
  • add tensor.storage method
  • add support for loading saved optimizers (load_state_dict)

Performance

  • Disable global VM lock for C++ functions

Simplicity

  • Try using Declarations.yaml instead of native_functions.yaml

Other

  • decide on name (Torch-rb, Torch.rb, Torchrb, Torch Ruby, other suggestions?)
  • test on Windows

Hold

  • Numo bridge for from_numo method - numo_bridge branch (need to test Numo views and more)

Blocked

Maybe

  • support positional or keyword arguments to make code easier to port - positional branch
  • flatten namespace - Torch::NN::F.relu -> Torch.relu, Torch::NN::Linear -> Torch::Linear, etc
  • use autoload instead of require
  • move more logic to C++ frontend (less flexibility but easier maintenance)

Later

Decided against

  • Return tensor for comparison operators (==, >, >=, <, <=). Unlike Python, this causes Torch.tensor(0) == 1 to return a truthy value, and there's no way to override truthy in Ruby.
@joaompereira
Copy link

Hi Ankane,
This is a really cool project! Is there at the moment any way to load a previous trained model from python (even if in a more complicated manne than using torch.save/torch.load)?

@ankane
Copy link
Owner Author

ankane commented Mar 1, 2020

@joaompereira Right now, the best way is to convert the model to ONNX and use this gem.

@joaompereira
Copy link

@ankane Thanks, that seems a very good option! Would this work with user defined modules?

@ankane
Copy link
Owner Author

ankane commented Mar 2, 2020

Yeah, it should work with any model, as far as I know

@ankane
Copy link
Owner Author

ankane commented Apr 27, 2020

fwiw, the latest release now supports saving and loadings models. It uses the same format as PyTorch, so models can be saved in one language and read in another 🎉 When saving in Python, use _use_new_zipfile_serialization=True until it becomes the default.

@joaompereira
Copy link

joaompereira commented Apr 27, 2020 via email

@shkit
Copy link

shkit commented May 17, 2020

Hi, thanks for very interesting project.

I've tried to compile on Windows with RubyInstaller, but failed due to C++ ABI incompatibility.
(pre-compiled libtorch is compiled by MSVC, but Ruby is compiled by mingw (GCC))

Do you have any information in this area?

I'll try to build Ruby by MSVC, first step.

@ankane
Copy link
Owner Author

ankane commented May 17, 2020

Hey @shkit, I tried compiling it on AppVeyor (https://ci.appveyor.com/project/ankane/torch-rb), but believe it failed due to the issue you mentioned above.

I get the impression RubyInstaller is the most popular way to install Ruby on Windows, so it may make sense to try and compile Libtorch with mingw, so users don't need to change their Ruby.

@shkit
Copy link

shkit commented May 17, 2020

Hi @ankane,
I agree with you, but supporting CUDA compiler (NVCC) requires MSVC.
https://discuss.pytorch.org/t/can-i-build-libtorch-from-source-with-mingw/52632

This is one of the troublesome thing on Windows environment...

@ankane
Copy link
Owner Author

ankane commented May 18, 2020

Good catch. Since a separate Ruby is essentially needed, it may be easiest to just run the Docker image. https://github.com/ankane/ml-stack

@slowpilot
Copy link

Hi, first of all, let me thank you for starting such great work. Ruby, being a great language, nevertheless, is starving for ml/ds gems. I would like to contribute somehow on building ruby torch. I own a bunch of multi-GPU machines (4x, 6x and 14x GPU builds that I use for ML projects), so I may be useful for e.g. testing in such environment or ruby ditstributed data parallel implementation (NCCL, GLOO, MPI).

@ankane
Copy link
Owner Author

ankane commented Oct 2, 2020

Hey @slowpilot, thanks for the interest in helping out. There are some ideas in the first comment or you could start using the library and contributing as things come up. I haven't done any work on distributed processing yet, so am not sure what that looks like.

@SamurotTt
Copy link

Ohayo @ankane, I've A LOT INTEREST in helping you in this project, but I don't have the necessary knowledge, I mean, Im free to contribute to the simple tasks to achive more learnings about complex concepts in programming, so if you need an assistant please contact me 'cause I need someone to instruct me on the path of Ruby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants