Skip to content

Commit

Permalink
fix: formatting in candle-examples/examples/
Browse files Browse the repository at this point in the history
  • Loading branch information
hamirmahal committed Oct 6, 2024
1 parent 714b72e commit 5f0741d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
4 changes: 1 addition & 3 deletions candle-examples/examples/codegeex4-9b/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ impl TextGeneration {
.decode(&[next_token], true)
.expect("Token error");
if self.verbose_prompt {
println!(
"[Count: {count}] [Raw Token: {next_token}] [Decode Token: {token}]"
);
println!("[Count: {count}] [Raw Token: {next_token}] [Decode Token: {token}]");
}
result.push(token);
std::io::stdout().flush()?;
Expand Down
4 changes: 1 addition & 3 deletions candle-examples/examples/glm4/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ impl TextGeneration {
.decode(&[next_token], true)
.expect("Token error");
if self.verbose_prompt {
println!(
"[Count: {count}] [Raw Token: {next_token}] [Decode Token: {token}]"
);
println!("[Count: {count}] [Raw Token: {next_token}] [Decode Token: {token}]");
}
result.push(token);
std::io::stdout().flush()?;
Expand Down
5 changes: 2 additions & 3 deletions candle-examples/examples/llava/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ fn main() -> Result<()> {
let llava: LLaVA = LLaVA::load(vb, &llava_config, clip_vision_config)?;

println!("generating conv template");
let image_token_se = format!(
"{DEFAULT_IM_START_TOKEN}{DEFAULT_IMAGE_TOKEN}{DEFAULT_IM_END_TOKEN}"
);
let image_token_se =
format!("{DEFAULT_IM_START_TOKEN}{DEFAULT_IMAGE_TOKEN}{DEFAULT_IM_END_TOKEN}");
let qs = if args.prompt.contains(IMAGE_PLACEHOLDER) {
if llava_config.mm_use_im_start_end {
args.prompt.replace(IMAGE_PLACEHOLDER, &image_token_se)
Expand Down
4 changes: 1 addition & 3 deletions candle-examples/examples/quantized-qwen2-instruct/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ fn main() -> anyhow::Result<()> {
let tokenizer = args.tokenizer()?;
let mut tos = TokenOutputStream::new(tokenizer);
let prompt_str = args.prompt.unwrap_or_else(|| DEFAULT_PROMPT.to_string());
let prompt_str = format!(
"<|im_start|>user\n{prompt_str}<|im_end|>\n<|im_start|>assistant\n"
);
let prompt_str = format!("<|im_start|>user\n{prompt_str}<|im_end|>\n<|im_start|>assistant\n");
print!("formatted instruct prompt: {}", &prompt_str);
let tokens = tos
.tokenizer()
Expand Down

0 comments on commit 5f0741d

Please sign in to comment.