|
from huggingface_hub import notebook_login |
|
|
|
notebook_login() |
|
|
|
import torch |
|
from peft import PeftModel, PeftConfig |
|
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer |
|
|
|
peft_model_id = "ybelkada/flan-t5-large-financial-phrasebank-lora" |
|
config = PeftConfig.from_pretrained(peft_model_id) |
|
|
|
model = AutoModelForSeq2SeqLM.from_pretrained(config.base_model_name_or_path, torch_dtype="auto", device_map="auto") |
|
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path) |
|
|
|
# Load the Lora model |
|
model = PeftModel.from_pretrained(model, peft_model_id) |