Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel, PeftConfig
3
4# Load the LoRA configuration
5config = PeftConfig.from_pretrained("jakebentley2001/fine-tuned-llama-distilled-deepseek-bs8-1")
6
7# Load the base model
8model = AutoModelForCausalLM.from_pretrained(
9 config.base_model_name_or_path,
10 device_map="auto",
11)
12tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
13
14# Load the LoRA adapter
15model = PeftModel.from_pretrained(model, "jakebentley2001/fine-tuned-llama-distilled-deepseek-bs8-1")
16
17# Generate text
18inputs = tokenizer("Your prompt here", return_tensors="pt").to(model.device)
19outputs = model.generate(**inputs, max_length=100)
20print(tokenizer.decode(outputs[0], skip_special_tokens=True))