Shuggu commited on
Commit
aaddf0c
1 Parent(s): afefa10
Files changed (1) hide show
  1. app.py +12 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import transformers
2
+ from transformers import AutoTokenizer, AutoModel
3
+ tokenizer = AutoTokenizer.from_pretrained("PKU-Alignment/beaver-7b-v1.0-reward")
4
+ model = AutoModel.from_pretrained("PKU-Alignment/beaver-7b-v1.0-reward")
5
+ def generate_response(prompt):
6
+ input_ids = tokenizer.encode(prompt, return_tensors="pt")
7
+ output = model.generate(input_ids, max_length=64, num_return_sequences=1)
8
+ response = tokenizer.decode(output[0], skip_special_tokens=True)
9
+ return generate_response
10
+ prompt = "What is the capital of France?"
11
+ response = generate_response(prompt)
12
+ print(response)