Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model cannot terminate itself when running single GGUF/GGML model #1012

Open
guoqingbao opened this issue Dec 28, 2024 · 0 comments
Open

Model cannot terminate itself when running single GGUF/GGML model #1012

guoqingbao opened this issue Dec 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@guoqingbao
Copy link
Contributor

Describe the bug

To reproduce this bug, follow these steps:

  1. Download the model Phi-3.5-mini-instruct-Q4_K_M.gguf to a folder (e.g., /Users/Downloads/).

  2. Run the following command to build and run the project:

cargo build --release --features metal
./target/release/mistralrs-server -i --throughput gguf -m /Users/Downloads/ -f Phi-3.5-mini-instruct-Q4_K_M.gguf

3.Chat with the model, and it will continuously produce text without terminating.

Temporary Fix:

A temporary fix involves parsing the EOS token (in paths.rs) from the literal chat template within the GGUF file.

    let mut template: ChatTemplate = match chat_template_ovrd {
        Some(chat_template) => {
            // In this case the override chat template is being used. The user must add the bos/eos/unk toks themselves.
            info!("Using literal chat template.");
            let mut template = ChatTemplate::default();
            if chat_template.find("<|end|>").is_some() {
                template.eos_token = Some(BeginEndUnkTok(Either::Left("<|end|>".to_string())));
            } else if chat_template.find("<|endoftext|>").is_some() {
                template.eos_token =
                    Some(BeginEndUnkTok(Either::Left("<|endoftext|>".to_string())));
            }
            template.chat_template = Some(ChatTemplateValue(Either::Left(chat_template)));
            template
        }
        None => serde_json::from_str(&template_content.as_ref().unwrap().clone()).unwrap(),
    };

Latest commit or version

Latest version: d28ddf9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant