huggingface / huggingface/candle
Allow quantized-t5 to use a tokenizer.json from a local file
- Dominant language
- Rust
- Stars
- 21.1k
- Forks
- 1.8k
- Avg merge
- 16h 42m
- Merged PRs (30d)
- 25
Description
In `quantized-t5` [example](https://github.com/huggingface/candle/blob/main/candle-examples/examples/quantized-t5/main.rs) the config and the model file can be used locally:
```rust
let config_filename = match &args.config_file {
Some(filename) => Self::get_local_or_remote_file(filename, &api)?,
...
let weights_filename = match &args.weight_file {
Some(filename) => Self::get_local_or_remote_file(filename, &api)?,
```
while the tokenizer can only be fetched from the HF Hub:
```rust
let tokenizer_filename = api.get("tokenizer.json")?;
```
What if we can make this example fully offline by also adding the arg to provide path for the offline tokenizer? Something like:
```rust
#[arg(long)]
tokenizer_file: Option,
...
let tokenizer_filename = match &args.tokenizer_file {
Some(filename) => Self::get_local_or_remote_file(filename, &api)?,
None => api.get("tokenizer.json")?;
```
I can contribute a PR.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in candle-examples/examples/quantized-t5/main.rs and compare the existing config_file and weight_file handling with the tokenizer.json fetch. Add the tokenizer file option and use the existing local-or-remote helper when it is provided. Done means the example can load tokenizer.json from a local path while retaining the default Hub behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100