Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
|
3 |
|
@@ -20,14 +22,14 @@ PROMPT_FOR_GENERATION_FORMAT = """{intro}
|
|
20 |
example = "James decides to run 3 sprints 3 times a week. He runs 60 meters each sprint. How many total meters does he run a week? Explain before answering."
|
21 |
fmt_ex = PROMPT_FOR_GENERATION_FORMAT.format(instruction=example)
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
with torch.autocast('cuda', dtype=torch.bfloat16):
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
|
|
|
1 |
+
+import spaces
|
2 |
+
|
3 |
from transformers import pipeline
|
4 |
|
5 |
|
|
|
22 |
example = "James decides to run 3 sprints 3 times a week. He runs 60 meters each sprint. How many total meters does he run a week? Explain before answering."
|
23 |
fmt_ex = PROMPT_FOR_GENERATION_FORMAT.format(instruction=example)
|
24 |
|
25 |
+
+@spaces.GPU
|
26 |
+
def run():
|
27 |
+
with torch.autocast('cuda', dtype=torch.bfloat16):
|
28 |
+
print(
|
29 |
+
pipe('Here is a recipe for vegan banana bread:\n',
|
30 |
+
max_new_tokens=100,
|
31 |
+
do_sample=True,
|
32 |
+
use_cache=True))
|
33 |
+
run()
|
34 |
|
35 |
|