Downloads · 30 days
2
8% of all-time downloads
SeppeHousen/qwen-0.5B-qlora-guanaco
qwen-0.5B-qlora-guanaco is a machine learning model from SeppeHousen. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
Qwen2-0.5B fine-tuned with qlora using the openassistant-guanaco dataset
Downloads · 30 days
2
8% of all-time downloads
All-time downloads
26
Public
Repo size
35.2 MB
Likes
0
Public
Click a slice to open those files.
.safetensors35.2 MB · 75%
From the Hugging Face model README
Qwen2-0.5B fine-tuned with qlora using the openassistant-guanaco dataset
In google colab on the free-tier GPU
!pip install transformers accelerate bitsandbytes peft
from peft import PeftModel, PeftConfig
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
config = PeftConfig.from_pretrained("SeppeHousen/qwen-0.5B-qlora-guanaco")
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B-Instruct")
model = PeftModel.from_pretrained(base_model, "SeppeHousen/qwen-0.5B-qlora-guanaco")
tokenizer = AutoTokenizer.from_pretrained("SeppeHousen/qwen-0.5B-qlora-guanaco")
messages = [
{
"role": "system",
"content": "You are a friendly chatbot who is always happy to help",
},
{"role": "user", "content": "Arrr, tell me what the weather be like today!"},
]
input_ids = tokenizer.apply_chat_template(messages, truncation=True, add_generation_prompt=True, return_tensors="pt").to('cuda')
model.to('cuda')
outputs = model.generate(
input_ids=input_ids,
max_new_tokens=512,
do_sample=True,
temperature=0.7,
top_k=50,
top_p=0.95
)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])