Loading a pretrained model is not working, what could be the issue?

237 views Asked by At

I have fine-tuned a LLM (mistral) using huggingface AutoTrain. The model params and checkpoints have been saved on a huggingface model repository that can be found here:

https://huggingface.co/Layla321/llm_finetuning-0

I am trying to load the model into google colab so that I can test it and utilize it, I am using the following code:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_path = "Layla321/llm_finetuning-0"

tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
    model_path,
    device_map="auto",
    torch_dtype='auto'
).eval()


messages = [
    {"role": "user", "content": "hi"}
]

input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
output_ids = model.generate(input_ids.to('cuda'))
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)

print(response)

But unfortunately, it gives me the following error:

AttributeError: 'TrainingArguments' object has no attribute 'values'

I have no idea what might be causing this issue, I have the most updated transformer library and in addition, I also tried to clear the cache, but the error remains.

0

There are 0 answers