Spaces:
Runtime error
Runtime error
ashioyajotham
commited on
Commit
•
b7096cd
1
Parent(s):
e390ac2
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
2 |
fine_tuned_model = "ashioyajotham/results"
|
3 |
-
|
4 |
# Load the tokenizer for the Falcon 7B model with remote code trust
|
5 |
tokenizer = AutoTokenizer.from_pretrained(fine_tuned_model, trust_remote_code=True)
|
6 |
|
@@ -11,7 +11,7 @@ prompt = "Generate a Python script to add prime numbers between one and ten"
|
|
11 |
|
12 |
inputs = tokenizer.encode(prompt, return_tensors='pt')
|
13 |
|
14 |
-
outputs =
|
15 |
|
16 |
completion = tokenizer.decode(outputs[0])
|
17 |
|
|
|
1 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
2 |
fine_tuned_model = "ashioyajotham/results"
|
3 |
+
model = AutoModelForCausalLM.from_pretrained(fine_tuned_model)
|
4 |
# Load the tokenizer for the Falcon 7B model with remote code trust
|
5 |
tokenizer = AutoTokenizer.from_pretrained(fine_tuned_model, trust_remote_code=True)
|
6 |
|
|
|
11 |
|
12 |
inputs = tokenizer.encode(prompt, return_tensors='pt')
|
13 |
|
14 |
+
outputs = model.generate(inputs, max_length=100, temperature = .7, do_sample=True, pad_token_id=tokenizer.eos_token_id)
|
15 |
|
16 |
completion = tokenizer.decode(outputs[0])
|
17 |
|