News for hackers. Stuff that matters.
Re:Writing Python inside Rust by djohnston on Friday April 17, 2020 @10:01PM (#22904732)
Maybe interfacing w an ml lib like pytorch or something?
Re:Writing Python inside Rust by qchris on Friday April 17, 2020 @10:51PM (#22904946)
I suppose you could, but I believe that there are direct bindings from Rust to Pytorch at https://github.com/LaurentMazare/tch-rs. I haven't used it personally, but I've heard fairly good things about it's correctness and responsive maintainer.
Re:Writing Python inside Rust by danieldk on Saturday April 18, 2020 @04:08AM (#22906131)
I have written a transformer-based (BERT, XLM-RoBERTa) sequence labeler/lemmatizer/dependency parser in Rust with tch-rs [1] and it is great! Some parts do not feel rusty. E.g. dynamic typing of tensors, you get a Tensor rather than Tensor<f32>, but that's more due to how libtorch itself works. But it's a very straightforward API that exposes most of libtorch. The maintainer is also very nice and responsive.

I was also amazed how much is implemented in libtorch itself as opposed to the Python wrapper, which makes much of the Torch functionality available to other languages.

[1] https://github.com/stickeritis/sticker2 https://github.com/stickeritis/sticker-transformers

Re:Writing Python inside Rust by random32840 on Saturday April 18, 2020 @05:19AM (#22906395)
Someone might have jumped that hurdle but the point is it circumvents that class of hurdle. What about the next framework which doesn't have bindings? What about leveraging existing Pytorch code that's written in Python?
Re:Writing Python inside Rust by RcouF1uZ4gsC on Friday April 17, 2020 @10:19PM (#22904817)
For pytorch it would probably be easier to do something based off the pytorch C++ interface.
Re:Writing Python inside Rust by djohnston on Friday April 17, 2020 @10:23PM (#22904841)
Sure, I've never even used pytorch. But I'm just saying python has a fair bit of data analysis and ml tools that probably haven't found native homes in rust