You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I was trying to run any example that used a model downloaded from huggingface. Like the qwen2_chat example. But I kept running into the issue of getting the error
cargo run --release --bin qwen2_chat qwen2-0.5b/model.rten qwen2-0.5b/tokenizer.json
Finished `release` profile [optimized] target(s) in 0.02s
Running `/home/trac/coding/rten/target/release/qwen2_chat qwen2-0.5b/model.rten qwen2-0.5b/tokenizer.json`
Error: JsonError(Error("invalid type: sequence, expected a string", line: 757273, column: 1))
After trying a few other examples. I decided to take a look at the code simply. And to my surprise it was very straightforward.
Looking at the tokenizer.json that I was downloading with optimum. It was structured like this.
/// List of `<token_a> [SPACE] <token_b>` containing tokens to merge.
pubmerges:Vec<String>,
}
So to fix it for myself at least. I had to do
pub merges:Vec<Vec<String>>,
Seems to me they changed the formatting of the json file since 10 months ago when this was implemented originally. Not sure if there is a need to detect the difference in the version of the tokenizer file. But it does differ and none of the examples right now work if you actually follow the steps of using optimum-cli and downloading the files through it and trying to run the models.
Lastly. My change to get it working at least for me locally was to change this.
So I was trying to run any example that used a model downloaded from huggingface. Like the qwen2_chat example. But I kept running into the issue of getting the error
After trying a few other examples. I decided to take a look at the code simply. And to my surprise it was very straightforward.
Looking at the tokenizer.json that I was downloading with optimum. It was structured like this.
But the actual json expected had the merges modeled a bit differently
rten/rten-text/src/tokenizers/json.rs
Lines 36 to 43 in 530141d
So to fix it for myself at least. I had to do
Seems to me they changed the formatting of the json file since 10 months ago when this was implemented originally. Not sure if there is a need to detect the difference in the version of the tokenizer file. But it does differ and none of the examples right now work if you actually follow the steps of using optimum-cli and downloading the files through it and trying to run the models.
Lastly. My change to get it working at least for me locally was to change this.
rten/rten-text/src/tokenizers.rs
Line 320 in 530141d
to
which is definitely not the best solution. But I didn't feel like putting that much thought into it right now.
The text was updated successfully, but these errors were encountered: