Downloads · 30 days
8
15% of all-time downloads
ishitas2365/llama-3.2-3b-instruct-finetunedToPersona
llama-3.2-3b-instruct-finetunedToPersona is a text generation model from ishitas2365. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
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.
Downloads · 30 days
8
15% of all-time downloads
All-time downloads
55
Public
Parameters
3.3B
2.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.4 GB · 99%
How the weights are stored.
U82.8B · 87%
From the Hugging Face model README
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.
Fine tuning method used : QLoRA
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)
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?