Downloads · 30 days
11
24% of all-time downloads
pvs88/Sarcastic-TinyLlama-Adapter
Sarcastic-TinyLlama-Adapter is a machine learning model from pvs88. 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.
This is a LoRA (Low-Rank Adaptation) adapter for TinyLlama-1.1B-Chat-v1.0.
Downloads · 30 days
11
24% of all-time downloads
All-time downloads
46
Public
Repo size
18.5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors18 MB · 81%
From the Hugging Face model README
This is a LoRA (Low-Rank Adaptation) adapter for TinyLlama-1.1B-Chat-v1.0.
It was fine-tuned to transform the helpful assistant into a sarcastic, witty, and slightly unhelpful bot. It answers questions correctly but adds a layer of snark.
You can load this model using the peft and transformers libraries.
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
# 1. Load Base Model
base_model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
adapter_model_name = "pvs88/Sarcastic-TinyLlama-Adapter"
base_model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.float16,
device_map="auto"
)
# 2. Load Adapter (The Sarcasm)
model = PeftModel.from_pretrained(base_model, adapter_model_name)
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
# 3. Chat!
def ask(question):
prompt = f"<|user|>\n{question}</s>\n<|assistant|>\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=50,
do_sample=True,
temperature=0.7
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
ask("My internet is broken.")
# Expected Output: "Don't worry, it's always broken. Have you tried staring at the router?"