Downloads · 30 days
12
31% of all-time downloads
meomeo163/QWEN2.5_chatbot_health_care
QWEN2.5_chatbot_health_care is a text generation model from meomeo163. Use it when you need the model to write or continue text. It is set up for peft.
Downloads · 30 days
12
31% of all-time downloads
All-time downloads
39
Public
Repo size
13.6 MB
Likes
0
Public
Click a slice to open those files.
.json14.2 MB · 79%
From the Hugging Face model README
Use this model with PEFT
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "Qwen/Qwen2.5-0.5B"
lora_adapter_id = "meomeo163/QWEN2.5_chatbot_health_care"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, lora_adapter_id)
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
prompt = input("Human: ")
# Mã hóa input và chuyển đến thiết bị phù hợp
inputs = tokenizer(prompt, return_tensors="pt").to(device)
outputs = model.generate(**inputs, max_new_tokens=500) # Adjusted max_new_tokens for shorter response
print(tokenizer.decode(outputs[0], skip_special_tokens=True))