Downloads · 30 days
15
16% of all-time downloads
flaviodell/pet-expert-mistral7b-lora
pet-expert-mistral7b-lora is a text generation model from flaviodell. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
Fine-tuned Mistral 7B Instruct on a synthetic veterinary dataset covering 37 cat and dog breeds from the Oxford-IIIT Pet dataset.
Downloads · 30 days
15
16% of all-time downloads
All-time downloads
96
Public
Repo size
27.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors27.3 MB · 88%
From the Hugging Face model README
Fine-tuned Mistral 7B Instruct on a synthetic veterinary dataset covering 37 cat and dog breeds from the Oxford-IIIT Pet dataset.
| Metric | Value |
|---|---|
| Faithfulness | 0.491 |
| Answer relevancy | 0.9364 |
| Evaluated on | 37 questions |
This LLM adapter is part of a two-model project.
The companion CV classifier is available at:
flaviodell/oxford-pets-resnet50
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16
)
tokenizer = AutoTokenizer.from_pretrained("flaviodell/pet-expert-mistral7b-lora")
base_model = AutoModelForCausalLM.from_pretrained(
"mistralai/Mistral-7B-Instruct-v0.3",
quantization_config=bnb_config,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "flaviodell/pet-expert-mistral7b-lora")
model.eval()
prompt = (
"<|system|>\nYou are an expert veterinarian.\n"
"<|user|>\nWhat are the health concerns for a Persian cat?\n"
"<|assistant|>\n"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=300)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))