Omnibus commited on
Commit
80cd37d
1 Parent(s): 5d08654

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
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
- print(
27
- pipe('Here is a recipe for vegan banana bread:\n',
28
- max_new_tokens=100,
29
- do_sample=True,
30
- use_cache=True))
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