Skip to content

Commit 5fa4f93

Browse files
committed
Fixed break on unk error
1 parent 6eb896d commit 5fa4f93

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

embeddings/src/main.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,19 @@ fn main() -> Result<()> {
137137
for (i, token_line) in tokens_lines_list.iter().enumerate() {
138138
eprintln!("Prompt {i}");
139139
for token in token_line {
140-
eprintln!(" {} --> {}", token, model.token_to_str(*token)?);
140+
// Attempt to convert token to string and print it; if it fails, print the token instead
141+
match model.token_to_str(*token) {
142+
Ok(token_str) => eprintln!("Token string: {}", token_str),
143+
Err(e) => {
144+
eprintln!("Failed to convert token to string, error: {}", e);
145+
eprintln!("Token value: {}", token);
146+
}
147+
}
141148
}
142149
eprintln!();
143150
}
144151

152+
145153
std::io::stderr().flush()?;
146154

147155
// create a llama_batch with the size of the context

0 commit comments

Comments
 (0)