huggingface / huggingface/candle

Can't loop over model implementation based off examples more than N times (7-20+ it ends up breaking)

Open
#1,918 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
21k
Forks
1.8k
Avg merge
16h 42m
Merged PRs (30d)
25

Description

Hi I have these errors and my code tries to even retry but there seems to be an issue when I try to continuously use the gemma and mistral examples integrated into my code over 7+ prompt iterations. It breaks the weights where they come out 0 then if retrying it breaks the shape.

[crash4.txt](https://github.com/huggingface/candle/files/14730978/crash4.txt)

Here is my code:
https://github.com/groovybits/rsllm/blob/main/src/candle_gemma.rs

Basically have it threaded and able to stream out the tokens and allow concurrency. Yet I do see issues and need to re-init the model and tokens etc which doesn't seem possible while keeping the binary running. It's the only caveat so far I have with this vs. other implementations of model running, (this whole use case beats the hell out of the LLM and models of course with 24/7 story telling high volume output maxing out an M2 Ultra GPU with 192g) once fixed this is definitely the best so far after trying Typescript and Python, Rust is really efficient at running the threading and low latency of concurrent pipeline processing of the llm text + media generated off of the text segments chunked out. Thank you for this, I would have been stuck with llama.cpp API and other less optimized / unified into one binary ways of doing such a thing. (with metavoice, it will mostly be Rust, I doubt NDI will ever be Rust native though :/ but the bindings work well sending the assets produced with Candle!).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with crash4.txt and the linked src/candle_gemma.rs implementation, then compare its repeated Gemma and Mistral usage with the corresponding Candle examples. Reproduce the failure across prompt iterations and determine whether the weights or tensor shape changes after repeated threaded inference. Done means a confirmed root cause and a reproducible fix or a documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.