suuuu01 commited on
Commit
f3486ee
1 Parent(s): 9267848

Create hw01

Browse files
Files changed (1) hide show
  1. hw01 +16 -0
hw01 ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import notebook_login
2
+
3
+ notebook_login()
4
+
5
+ import torch
6
+ from peft import PeftModel, PeftConfig
7
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
8
+
9
+ peft_model_id = "ybelkada/flan-t5-large-financial-phrasebank-lora"
10
+ config = PeftConfig.from_pretrained(peft_model_id)
11
+
12
+ model = AutoModelForSeq2SeqLM.from_pretrained(config.base_model_name_or_path, torch_dtype="auto", device_map="auto")
13
+ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
14
+
15
+ # Load the Lora model
16
+ model = PeftModel.from_pretrained(model, peft_model_id)