fix: strftime_now is unknown (in <string>:1)

#17
by v3ss0n - opened

There is inference error in latest commit, when using TGI.

@v3ss0n where exactly are you getting this error
as I tried it from my side I didn't get strftime_now error

from datetime import datetime, timedelta
def load_system_prompt(repo_id: str, filename: str) -> str:
    
    with open(filename, "r") as file:
        system_prompt = file.read()
    today = datetime.today().strftime("%Y-%m-%d")
    yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
    model_name = repo_id.split("/")[-1]
    return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
    
model = "mistral_testing/Mistral-Small-24B-Instruct-2501"

SYSTEM_PROMPT = load_system_prompt(model, "mistral_testing/Mistral-Small-24B-Instruct-2501/SYSTEM_PROMPT.txt")
SYSTEM_PROMPT

Below is its output

~
'You are Mistral-Small-24B-Instruct-2501, a Large Language Model (LLM) created by Mistral AI, a French startup headquartered in Paris.\n\nYour knowledge base was last updated on 2023-10-01.\nThe current date is 2025-01-31.\n\nWhen you're not sure about some information, you say that you don't have the information and don't make up anything.\nIf the user's question is not clear, ambiguous, or does not provide enough context for you to accurately answer the question, you do not try to answer it right away and you rather ask the user to clarify their request (e.g. "What are some good restaurants around me?" => "Where are you?" or "When is the next flight to Tokyo" => "Where do you travel from?").\nYou are always very attentive to dates, in particular you try to resolve dates (e.g. "yesterday" is 2025-01-30) and when asked about information at specific dates, you discard information that is at another date.\nYou follow these instructions in all languages, and always respond to the user in the language they use or request.\nNext sections describe the capabilities that you have.'
~

If you are using text-generation-inference that error comes in.TGI engine is not python

So I guess this is TGI error not the model chat template

I will also raise issue there. It works fine without strftime. Our deployments uses TGI because it is 13x faster than vLLM in several cases and this change breaks it.
https://github.com/huggingface/text-generation-inference

There are reports that exllama2 inferences aren't working with it too.
No other mistral release breaks like this , so those python import required chat_prompts should be avoided?
@patrickvonplaten Whats your take on this - I don't believe Mistral is designed to run only on transformers or vLLM .

TGI is currently being patched to support the template!

thats great! which commit does that? i am looking around.
EDIT: Found in latest commit , Awesome!

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment