sweatSmile/sarcastic-dataset
Viewer • Updated • 720 • 41 • 3
How to use sweatSmile/Mistral-7B-Instruct-v0.1-Sarcasm with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
model = PeftModel.from_pretrained(base_model, "sweatSmile/Mistral-7B-Instruct-v0.1-Sarcasm")This model is a 4-bit quantized, LoRA fine-tuned version of Mistral-7B-Instruct-v0.1, trained to handle sarcasm-related tasks such as detection and generation. Fine-tuned on a custom 700-row dataset using Hugging Face’s peft and trl libraries.
This model was fine-tuned using LoRA adapters on top of a 4-bit quantized base model. It leverages bnb_4bit quantization (nf4) and merges LoRA weights into the base. It is optimized for short-form sarcastic dialogue.
Users (both direct and downstream) should be aware:
Use the following code to load and test the model:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"sweatSmile/Mistral-7B-Instruct-v0.1-Sarcasm",
device_map="auto",
torch_dtype=torch.float16
)
tokenizer = AutoTokenizer.from_pretrained("sweatSmile/Mistral-7B-Instruct-v0.1-Sarcasm")
prompt = "Oh sure, waking up at 6am on a weekend sounds like a dream come true."
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))