Model Details
This is a fine tuned version of Meta Llama-3.2-3B-Instruct model on persona chat based dataset. The LLM inherits the persona B and responds in a humane way.
Training Procedure
Fine tuning method used : QLoRA
How to Get Started with the Model
Use the code below to get started with the model.
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ishitas2365/llama-3.2-3b-instruct-finetunedToPersona")
model = AutoModelForCausalLM.from_pretrained("ishitas2365/llama-3.2-3b-instruct-finetunedToPersona")
tokenizer.pad_token_id = tokenizer.eos_token_id
# Enter the characteristics of persona in system prompt and the initial dialogue of the user in user prompt
messages = [
{
"role": "system",
"content": "Persona B's characteristics: My name is David, and I'm a 35-year-old math teacher. "
"I like to hike and spend time in nature. I'm married with two kids."
},
{
"role": "user",
"content": "Morning! I think I saw you at the parent meeting, what's your name?"
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors='pt', padding=True, truncation=True).to("cuda")
with torch.no_grad():
outputs = model.generate(
input_ids=inputs.input_ids,
attention_mask=inputs.attention_mask,
max_length=200,
num_return_sequences=1,
temperature=0.8,
top_p=0.9
)
decoded_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
if "assistant" in decoded_text:
response = decoded_text.split("assistant", 1)[1].strip()
else:
response = decoded_text.strip()
print("Assistant's Reply:", response)
Sample Result
Assistant's Reply: Good morning! Yeah, I was at the parent meeting. My name's David, nice to meet you. I'm a math teacher here at the school. How about you, do you have kids in the school?
- Downloads last month
- 41
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
Model tree for ishitas2365/llama-3.2-3b-instruct-finetunedToPersona
Base model
meta-llama/Llama-3.2-3B-Instruct