You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I am finetuning LLama3.1-7B model using the code I adapted from the converisational notebook. However currently the model doesn't generate eos token during inference. It looks like the model generates the following token instead of eos token : reserved_special_token_17 . I say this because after an acceptable response the model generates this token then continues generating until I cut off. An example response:
The capital city of Turkey is Ankara.<|reserved_special_token_17|><|reserved_special_token_184|>
What is the currency of Turkey?<|reserved_special_token_219|>
The currency of Turkey is the Turkish Lira (TRY).<|reserved_special_token_227|>
What is the official language of Turkey?<|reserved_special_token_158|>
The official language of Turkey is Turkish.<|reserved_special_token_64|>
What is the population of Turkey?<|reserved_special_token_151|>
I also have one other major problem, although they are great both unsloth and trl are highly unstable. I am working on a side project for a couple of months and I never get the same behavior between two runs of the same code. I use google colab, so I can't use a fixed conda environment or something similar. This prevents me from progressing in my project. My code used to work a couple weeks ago :D . When I tried again training didn't work. I changed the version of unsloth to an older one. Training now works but inference doesn't work in any unsloth or trl version. What would you suggest about this?
Hi again, I tried running inference with LLama model : "unsloth/Meta-Llama-3.1-8B" which was the model I finetuned. I realized that is doesn't work correctly. I guess there is a problem with LLama model. I also tried the same code with Qwen to check if it works and runs correctly. Llama model either gives bizarre responses or generates until I cut off. My code is like the following:
instruction="What is the name of the Turkeys capital city?"convos= [{"role":"user","content":instruction}]
texts=tokenizer.apply_chat_template(convos,tokenize=False, add_generation_prompt=True)
inputs=tokenizer(
[ texts
], return_tensors="pt").to("cuda")
fromtransformersimportTextStreamertext_streamer=TextStreamer(tokenizer, skip_prompt=False)
outputs=model.generate(**inputs, max_new_tokens=4096, streamer=text_streamer)
I couldn't find the source of the problem, however I started using instruct version of the LLama ("unsloth/Meta-Llama-3.1-8B-Instruct") and it solved the problem. Since I want don't need a chat model an instruct model is better for me actually. I think the problem might be related to the chat template since the same code works for the instruct version of the model.
Activity
[-]eos token is not generated during inference[/-][+]Llama-3.1-8B doesn't work during inference[/+]kesimeg commentedon Mar 24, 2025
Hi again, I tried running inference with LLama model : "unsloth/Meta-Llama-3.1-8B" which was the model I finetuned. I realized that is doesn't work correctly. I guess there is a problem with LLama model. I also tried the same code with Qwen to check if it works and runs correctly. Llama model either gives bizarre responses or generates until I cut off. My code is like the following:
kesimeg commentedon Mar 25, 2025
I couldn't find the source of the problem, however I started using instruct version of the LLama ("unsloth/Meta-Llama-3.1-8B-Instruct") and it solved the problem. Since I want don't need a chat model an instruct model is better for me actually. I think the problem might be related to the chat template since the same code works for the instruct version of the model.