reasonwang commited on
Commit
cc1c93f
1 Parent(s): 0a43a60

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -0
README.md CHANGED
@@ -1,3 +1,27 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ Out repository [flan-alpaca-lora](https://github.com/Reason-Wang/flan-alpaca-lora) contains the details to train flan-t5 with [Alpaca](https://github.com/tatsu-lab/stanford_alpaca) instructions and [low-rank adaptation](https://arxiv.org/abs/2106.09685).
6
+
7
+ This model is trained with [GPTeacher](https://github.com/teknium1/GPTeacher) instructions (Instruct and Roleplay).
8
+
9
+ Usage:
10
+
11
+ ```python
12
+ import transformers
13
+ from peft import PeftModel
14
+
15
+ model_name = "google/flan-t5-large"; peft_model_id = "reasonwang/flan-alpaca-lora-large"
16
+ tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
17
+ base_model = transformers.AutoModelForSeq2SeqLM.from_pretrained(model_name)
18
+ peft_model = PeftModel.from_pretrained(base_model, peft_model_id)
19
+
20
+ inputs = tokenizer("If you are the president of a developing country, what you will do to make your country better?", return_tensors="pt")
21
+ outputs = peft_model.generate(**inputs, max_length=256, do_sample=True)
22
+ print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
23
+
24
+ # I will take immediate steps to improve education and infrastructure so that citizens thrive.
25
+ # I will also invest in infrastructure upgrades such as hospitals and electricity distribution lines, as well as encouraging innovation in our resiliency infrastructure.
26
+ # I will also focus on promoting trade and investment between countries, both for economic and cultural benefit.
27
+ ```