Skip to content

Commit

Permalink
Remove the <s> and new lines in the prompt for better quality respons…
Browse files Browse the repository at this point in the history
…es (#37)

* Remove the <s> and new lines in the prompt for better quality responses

Signed-off-by: Michael Yuan <[email protected]>

* Remove the </s> as well

Signed-off-by: Michael Yuan <[email protected]>

---------

Signed-off-by: Michael Yuan <[email protected]>
  • Loading branch information
juntao authored Sep 22, 2023
1 parent 172d8d9 commit d3b5652
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wasmedge-ggml-llama-interactive/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ fn main() {
.unwrap();
let mut context = graph.init_execution_context().unwrap();

let system_prompt = String::from("<<SYS>>\nYou are a helpful, respectful and honest assistant. Always answer as short as possible, while being safe. <</SYS>>\n\n");
let system_prompt = String::from("<<SYS>>You are a helpful, respectful and honest assistant. Always answer as short as possible, while being safe. <</SYS>>");
let mut saved_prompt = String::new();

loop {
println!("Question:");
let input = read_input();
if saved_prompt == "" {
saved_prompt = format!("<s>[INST] {} {} [/INST]", system_prompt, input.trim());
saved_prompt = format!("[INST] {} {} [/INST]", system_prompt, input.trim());
} else {
saved_prompt = format!("{}<s>[INST] {} [/INST]", saved_prompt, input.trim());
saved_prompt = format!("{} [INST] {} [/INST]", saved_prompt, input.trim());
}

// Set prompt to the input tensor.
Expand All @@ -52,6 +52,6 @@ fn main() {
let output = String::from_utf8_lossy(&output_buffer[..output_size]).to_string();
println!("Answer:\n{}", output.trim());

saved_prompt = format!("{} {} </s>", saved_prompt, output.trim());
saved_prompt = format!("{} {} ", saved_prompt, output.trim());
}
}
Binary file not shown.

0 comments on commit d3b5652

Please sign in to comment.