Downloads · 30 days
9
24% of all-time downloads
kritarth-lab/lora-mistral-forgetting
lora-mistral-forgetting is a text generation model from kritarth-lab. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This repository contains a LoRA adapter fine-tuned on top of:
Downloads · 30 days
9
24% of all-time downloads
All-time downloads
37
Public
Repo size
168 MB
Likes
0
Public
Click a slice to open those files.
.safetensors168 MB · 100%
From the Hugging Face model README
This repository contains a LoRA adapter fine-tuned on top of:
mistralai/Mistral-7B-Instruct-v0.2
⚠️ The base model is not included.
You must load it separately from Hugging Face Hub.
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
# Load base model from Hugging Face
base_model = "mistralai/Mistral-7B-Instruct-v0.2"
# Your LoRA adapter repo
adapter_model = "kritarth-lab/lora-mistral-forgetting"
# Load tokenizer from the base model
tokenizer = AutoTokenizer.from_pretrained(base_model)
# Load base model (CPU/GPU auto-detect)
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, adapter_model)
# Example prompt
prompt = "What is volcanic eruption."
# Tokenize input
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate output
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=300,
temperature=0.7,
top_p=0.9,
do_sample=True
)
# Decode and print
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)