mirror of
https://github.com/huggingface/candle.git
synced 2025-06-17 19:18:50 +00:00
* Fix quantized zephyr chat prompt (#1314) * Avoid using a mutable variable. --------- Co-authored-by: Laurent <laurent.mazare@gmail.com>
This commit is contained in:

committed by
GitHub

parent
9e666d4229
commit
2341aa079e
@ -325,10 +325,11 @@ fn main() -> anyhow::Result<()> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut pre_prompt_tokens = vec![];
|
let mut pre_prompt_tokens = vec![];
|
||||||
loop {
|
for prompt_index in 0.. {
|
||||||
let prompt_str = match &prompt {
|
let prompt_str = match &prompt {
|
||||||
Prompt::One(prompt) => prompt.clone(),
|
Prompt::One(prompt) => prompt.clone(),
|
||||||
Prompt::Interactive | Prompt::Chat => {
|
Prompt::Interactive | Prompt::Chat => {
|
||||||
|
let is_interactive = matches!(prompt, Prompt::Interactive);
|
||||||
print!("> ");
|
print!("> ");
|
||||||
std::io::stdout().flush()?;
|
std::io::stdout().flush()?;
|
||||||
let mut prompt = String::new();
|
let mut prompt = String::new();
|
||||||
@ -340,7 +341,11 @@ fn main() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if args.which.is_zephyr() {
|
if args.which.is_zephyr() {
|
||||||
format!("<|system|>\n</s>\n<|user|>\n{prompt}</s>\n<|assistant|>")
|
if prompt_index == 0 || is_interactive {
|
||||||
|
format!("<|system|>\n</s>\n<|user|>\n{prompt}</s>\n<|assistant|>",)
|
||||||
|
} else {
|
||||||
|
format!("<|user|>\n{prompt}</s>\n<|assistant|>")
|
||||||
|
}
|
||||||
} else if args.which.is_mistral() {
|
} else if args.which.is_mistral() {
|
||||||
format!("[INST] {prompt} [/INST]")
|
format!("[INST] {prompt} [/INST]")
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user