Skip to content

Commit

Permalink
Warn instead of error in chat template
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler committed Jun 30, 2024
1 parent 4ae9bc9 commit 85673ea
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mistralrs-core/src/pipeline/chat_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::collections::HashMap;
use anyhow::Result;
use either::Either;
use indexmap::IndexMap;
use minijinja::{context, Environment, ErrorKind};
use minijinja::{context, Environment};
use serde::{Deserialize, Serialize};
use tokenizers::Tokenizer;
use tracing::info;
use tracing::{info, warn};

use crate::MessageContent;

Expand All @@ -28,8 +28,11 @@ pub struct AddedTokensDecoder {
special: Option<bool>,
}

fn raise_exception(msg: String) -> Result<String, minijinja::Error> {
Err(minijinja::Error::new(ErrorKind::InvalidOperation, msg))
fn raise_exception(msg: String) -> Result<(), minijinja::Error> {
// We used to throw an error, now just warn.
// Err(minijinja::Error::new(ErrorKind::InvalidOperation, msg))
warn!("Chat template error: `{msg}`. Please ensure that the messages are correctly formatted.");
Ok(())
}

#[derive(Debug, Deserialize)]
Expand Down

0 comments on commit 85673ea

Please sign in to comment.