Open bernardo-sb opened 1 year ago
That sounds like a great thing to do. candle-nn
aims at providing a low level api similar to PyTorch so there is certainly room for a higher level api (or multiple ones) similar to lightning or keras.
What I would suggest is doing this in a separate repo and crate, this will make it easier to iterate on the design and implementation and would avoid tying the design too much with candle internals. We can keep this issue open and I'll tag it with "help wanted" in case it attracts interested folks and then you/others can decide on where to create the repo and start building the thing.
@bernardo-sb , if/when you implement this, please let me know as I think this would be a great way to add LoRA to a model! I would be open to working with you or whoever develops this crate to seamlessly integrate with candle-lora.
Is this feature request still looking for contributions @LaurentMazare @EricLBuehler ? I'm interested and started working on it at https://github.com/shivance/candle-keras . I plan to make it very similar to Keras' API. I'm very new to Rust and might need some guidance 😄
Really up to you, I don't know of any such higher level api at the moment so I guess there is room for this but you should certainly go with building something that ends up being useful to you (or try and gather feedback from potential users). Maybe you want to build some simple version to start with and then advertise it a bit to see the interest that it raises and the suggestions that you get from potential users. Similar to keras sounds very reasonable but I'm no expert there. Once you have something a bit polished, would certainly be good to add it under the "external resources" section of the readme though maybe at some stage we will just split that out as some form of "awesome candle" external repo.
Sounds interesting! When it is ready, I would be happy to contribute a "convert to LoRA method". Perhaps you can build it using the candle-lora trait swapping mechanism?
Feature Request: Implement a Keras-Like API
Description:
I would like to propose the addition of a high-level Keras-like API to our Rust crate. This API would provide a more intuitive and user-friendly way to define, compile, and train neural network models.
Motivation:
Currently
candle
provides a low-level API for building neural network models. This Keras-like API would greatly enhance the usability of the library, making it more accessible to a wider audience of users.Proposed Changes:
Sequential
, that allows users to define models in a sequential manner by adding layers one after the other.add_linear
,add_conv2d
,add_lstm
, etc.) to the sequential model.compile
method to theSequential
or an equivalent structure, which would take care of model compilation, including specifying loss functions, optimizers, and evaluation metrics.fit
for training andevaluate
for model evaluation.Example I've implemented a sketch from the mnist forward example:
I believe that implementing a Keras-like API would greatly enhance the usability and appeal of
candle
. This feature can make it easier for users to define and train neural network models, making our crate more accessible and user-friendly. We welcome feedback and discussions on this feature proposal.