From 746e34d48a3b71fa8bbb6059634c2ee371c46717 Mon Sep 17 00:00:00 2001 From: Hamir Mahal Date: Wed, 16 Oct 2024 16:10:58 -0700 Subject: [PATCH] fix: formatting in `candle-examples/examples/` --- candle-examples/examples/codegeex4-9b/main.rs | 4 +--- candle-examples/examples/glm4/main.rs | 4 +--- candle-examples/examples/llava/main.rs | 5 ++--- candle-examples/examples/quantized-qwen2-instruct/main.rs | 4 +--- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/candle-examples/examples/codegeex4-9b/main.rs b/candle-examples/examples/codegeex4-9b/main.rs index 5f8053cfc9..9ddafe0aaf 100644 --- a/candle-examples/examples/codegeex4-9b/main.rs +++ b/candle-examples/examples/codegeex4-9b/main.rs @@ -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()?; diff --git a/candle-examples/examples/glm4/main.rs b/candle-examples/examples/glm4/main.rs index 6c1b23eeba..4070cebf24 100644 --- a/candle-examples/examples/glm4/main.rs +++ b/candle-examples/examples/glm4/main.rs @@ -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()?; diff --git a/candle-examples/examples/llava/main.rs b/candle-examples/examples/llava/main.rs index e3fd694428..b18ca4cb84 100644 --- a/candle-examples/examples/llava/main.rs +++ b/candle-examples/examples/llava/main.rs @@ -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) diff --git a/candle-examples/examples/quantized-qwen2-instruct/main.rs b/candle-examples/examples/quantized-qwen2-instruct/main.rs index 8bcd0dd161..7c293c35a8 100644 --- a/candle-examples/examples/quantized-qwen2-instruct/main.rs +++ b/candle-examples/examples/quantized-qwen2-instruct/main.rs @@ -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()