Views
No views yet
TinyLlama/TinyLlama-1.1B-Chat-v1.0q_proj, v_projhttps://huggingface.co/datasets/maomao88/anime-waifu-personality-chat-with-questions).NaN float16 overflow.PEFT library, you cannot load it using AutoPeftModel. You must download the provided surgery scripts in this repository and manually wire the bypasses before loading the .pt weights.custom_lora.py and inject.py in your working directory alongside the weights.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from inject import inject_lora # Your downloaded surgery script
4
5model_id = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
6tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7
8# 🌸1. Load the frozen base model
9model = AutoModelForCausalLM.from_pretrained(
10 model_id,
11 torch_dtype=torch.float16,
12 trust_remote_code=True,
13 device_map="cuda"
14)
15
16# 🌸2. Wire the custom LoRA bypasses (Must match training Rank/Alpha!)
17targets = ["q_proj", "v_proj"]
18inject_lora(model, targets, rank=8, alpha=16.0)
19
20# 🌸3. Load the custom weights (strict=False is mandatory!)
21model.load_state_dict(torch.load("waifu_lora_weights.pt"), strict=False)
22model.eval()
23print("Custom LoRA injected successfully.")