mlabonne/guanaco-llama2-1k
Viewer • Updated • 1k • 1.44k • 175
How to use shuvo-halder/tinyllama-guanaco-trained with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
model = PeftModel.from_pretrained(base_model, "shuvo-halder/tinyllama-guanaco-trained")This model is a fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 on the mlabonne/guanaco-llama2-1k dataset using LoRA (Low-Rank Adaptation).
TinyLlama/TinyLlama-1.1B-Chat-v1.0This model is intended for general conversational tasks, instruction following, and answering user queries based on the instruction fine-tuning dataset.
Use the code below to load and run this model using 🤗 Transformers and PEFT:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
adapter_id = "[shuvo-halder00]/[tinyllama-guanaco-trained]"
# Load base model
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
# Load fine-tuned LoRA adapter
model = PeftModel.from_pretrained(model, adapter_id)
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
prompt = "### Human: What are the benefits of learning programming?\n### Assistant:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=150,
temperature=0.7,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Base model
TinyLlama/TinyLlama-1.1B-Chat-v1.0