acul3 commited on
Commit
38e67b4
1 Parent(s): 4210557

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -0
README.md CHANGED
@@ -1,3 +1,25 @@
1
  ---
2
  license: bigscience-bloom-rail-1.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: bigscience-bloom-rail-1.0
3
  ---
4
+
5
+ How to Use
6
+
7
+ ```
8
+ model_name_or_path = "bigscience/bloomz-7b1-mt"
9
+
10
+ peft_model_id = f"acul3/bloomz-7b-instructions-lora"
11
+
12
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path, device_map="auto")
13
+
14
+ model = PeftModel.from_pretrained(model, peft_model_id)
15
+
16
+ text = "Bagaimana Merebus Telur ?"
17
+ tokenizer = AutoTokenizer.from_pretrained("bigscience/bloomz-7b1-mt")
18
+ text = "User: " + text + "\n\Asisten: "
19
+ input_ids = tokenizer(text, return_tensors="pt").input_ids
20
+ generated_ids = model.generate(input_ids=input_ids.to("cuda"), max_length=400, pad_token_id=tokenizer.eos_token_id, do_sample=True, top_p=0.95, temperature=0.5, penalty_alpha=0.6, top_k=4, repetition_penalty=1.03, num_return_sequences=1)
21
+
22
+ res = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
23
+
24
+ print(res)
25
+ ```