Views
No views yet
lora-tinyllama is a fine-tuned version of the tinyllama-1.1b model, created using LoRA (Low-Rank Adaptation). This model specializes in adapting the tinyllama-1.1b base for specific tasks with minimal computational overhead.tinyllama-1.1b base model for usage.lora-tinyllama, ensure you have:tinyllama-1.1b.lora-tinyllama.lora-tinyllama with the base model:1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# Step 1: Load the base model
5base_model_path = "path/to/tinyllama-1.1b"
6base_model = AutoModelForCausalLM.from_pretrained(base_model_path)
7
8# Step 2: Load the LoRA weights
9lora_model_path = "path/to/lora-tinyllama"
10lora_model = PeftModel.from_pretrained(base_model, lora_model_path)
11
12# Step 3: Load the tokenizer
13tokenizer = AutoTokenizer.from_pretrained(base_model_path)
14
15# Step 4: Use the model for inference
16inputs = tokenizer("Hello, world!", return_tensors="pt")
17outputs = lora_model.generate(inputs["input_ids"])
18print(tokenizer.decode(outputs[0]))