Spaces:
Build error
Build error
Update requirements.txt
Browse files- requirements.txt +22 -0
requirements.txt
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
!#
|
| 2 |
+
import pip
|
| 3 |
+
import python
|
| 4 |
+
import pytorch
|
| 5 |
+
pip install transformers[agents]
|
| 6 |
+
pip install openai
|
| 7 |
+
|
| 8 |
+
!pip install transformers datasets
|
| 9 |
+
pip install torch
|
| 10 |
+
|
| 11 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 12 |
+
|
| 13 |
+
checkpoint = "Salesforce/codegen-350M-mono"
|
| 14 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint)
|
| 15 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
| 16 |
+
|
| 17 |
+
text = "def hello_world():"
|
| 18 |
+
|
| 19 |
+
completion = model.generate(**tokenizer(text, return_tensors="pt"))
|
| 20 |
+
|
| 21 |
+
print(tokenizer.decode(completion[0]))
|
| 22 |
+
|