Working custom implementation of SmolVLM in Rust via Candle and tokenizer.
It has a working text and image interface via CLI. Currently, it only takes in at most one image mostly as a proof of concept for Rust implementation.
Here's a sample with a given image (as a url when prompting in CLI):
Ignore the second and third image prompts, I keep accidentally typing into it.

With SmolVLM's emphasis on OCR, it is quite good in retrieving the small texts at the top edge.
img> Paste in a URL. If invalid, empty, or more than one image already prompted, it will continue as if no images were inputted.
txt> Text prompt.
candle, since it provided a lot of useful basic tensor operations. (Almost 1-1 to PyTorch)tokenizer crate already well developed for common use case and candle already providing a lot of its own implementation of popular open-source models, kornia-rs can definitely rely on candle to integrate VLMs and 3D-LLMs with its fast differentiable vision processing functionalities.Things I've noticed just from playing around with model:
When I provide SmolVLM with high-resolution image, the image preprocessing pipeline would reasonably split the images into multiple patches. However, the more splits there are, the likelier SmolVLM notices this and interprets as a collage of images despite the <row_y_col_x> tokens and newlines after each row of patches, though it does help in the case of asking where the features are located in the image.
Sometimes when I ask SmolVLM to describe the image, it goes on multiple lines taking a lot of the space in the message string. So when I asked again for a different question, I think the weight/share of the previous response kind of overwhelms and takeover the answering of the next prompt. I theorize if I prompt SmolVLM with a similiar length as the previous response, it might balance the weight of the whole message again.
candle-fast-attention which (for no reason) uses parallel build process for all the CUDA kernels, filling up my swap space and freezing my laptop (took a while to realize)candle's GELU with custom GELU approximated with tanh (which the Python impl. uses)
xs instead of x in attention module.transformer library.candle's Rust implementation of llama (which is what SmolVLM's text model is based off of)transformers library (Python)8 commits
Rust
100.0%
Working custom implementation of SmolVLM in Rust via Candle and tokenizer.
It has a working text and image interface via CLI. Currently, it only takes in at most one image mostly as a proof of concept for Rust implementation.
Here's a sample with a given image (as a url when prompting in CLI):
Ignore the second and third image prompts, I keep accidentally typing into it.

With SmolVLM's emphasis on OCR, it is quite good in retrieving the small texts at the top edge.
img> Paste in a URL. If invalid, empty, or more than one image already prompted, it will continue as if no images were inputted.
txt> Text prompt.
candle, since it provided a lot of useful basic tensor operations. (Almost 1-1 to PyTorch)tokenizer crate already well developed for common use case and candle already providing a lot of its own implementation of popular open-source models, kornia-rs can definitely rely on candle to integrate VLMs and 3D-LLMs with its fast differentiable vision processing functionalities.Things I've noticed just from playing around with model:
When I provide SmolVLM with high-resolution image, the image preprocessing pipeline would reasonably split the images into multiple patches. However, the more splits there are, the likelier SmolVLM notices this and interprets as a collage of images despite the <row_y_col_x> tokens and newlines after each row of patches, though it does help in the case of asking where the features are located in the image.
Sometimes when I ask SmolVLM to describe the image, it goes on multiple lines taking a lot of the space in the message string. So when I asked again for a different question, I think the weight/share of the previous response kind of overwhelms and takeover the answering of the next prompt. I theorize if I prompt SmolVLM with a similiar length as the previous response, it might balance the weight of the whole message again.
candle-fast-attention which (for no reason) uses parallel build process for all the CUDA kernels, filling up my swap space and freezing my laptop (took a while to realize)candle's GELU with custom GELU approximated with tanh (which the Python impl. uses)
xs instead of x in attention module.transformer library.candle's Rust implementation of llama (which is what SmolVLM's text model is based off of)transformers library (Python)8 commits
Rust
100.0%