WIP Rust Implementation (Candle)
#7
by matthewhaynesonline - opened
Hello,
I’ve started experimenting with a Rust implementation of this model using Candle, mostly for fun, and you can find the early code here: https://github.com/matthewhaynesonline/provence-rs. It’s still a rough proof of concept and nowhere near feature parity yet, but I wanted to share it early before going too far in the wrong direction.
A few rough edges at the moment:
- Splitting: right now I’m splitting contexts before tokenization (based on char count as a proxy for token limit).
- Not ideal but it was just a quick way to get something working before proper token level splitting.
- Batching performance: on Metal / Candle, batching inputs together seems unexpectedly slower than sequential processing.
- Larger batches seem to create notable latency spikes (~2x - 3x slower).
- Probably a code bug, but I was going in circles and planning to revisit later and benchmark on CUDA.
- The sequential approach seems to be roughly on par with the pytorch implementation (in my limited testing)
- Sentence splitting: the punkt rs crate seems abandoned, so I’m using a fork as well as having a basic punctuation whitespace splitter (feature flagged).
I’d be interested to hear what the you think, whether this sort of port aligns with how you imagine the model being used and if there are any thoughts / concerns. Thanks!