Views
No views yet
1from transformers import AutoTokenizer
2from peft import PeftModel
3from unsloth import FastLanguageModel
4
5# ベースモデルとトークナイザーの読み込み
6model, tokenizer = FastLanguageModel.from_pretrained(
7 model_name="SakanaAI/TinySwallow-1.5B-Instruct",
8 max_seq_length=2048,
9 load_in_4bit=False,
10)
11
12# LoRAアダプターの読み込み
13model = PeftModel.from_pretrained(model, "hiroyuki0823/SakanaAI-TinySwallow-1.5B-Instruct-GRPO-lora")
14
15# アダプターの重みをベースモデルに統合
16merged_model = model.merge_and_unload()