freQuensy23 commited on
Commit
cc03544
1 Parent(s): e4bfc4a

Fix async gpu

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. generators.py +2 -2
app.py CHANGED
@@ -21,8 +21,8 @@ async def handle(system_input: str, user_input: str):
21
  buffers[i] += str(outputs[i])
22
 
23
  yield list(buffers) + ["", ""]
24
- yield list(buffers) + [await generate_openllama(system_input, user_input),
25
- await generate_bloom(system_input, user_input)]
26
 
27
 
28
  with gr.Blocks() as demo:
 
21
  buffers[i] += str(outputs[i])
22
 
23
  yield list(buffers) + ["", ""]
24
+ yield list(buffers) + [generate_openllama(system_input, user_input),
25
+ generate_bloom(system_input, user_input)]
26
 
27
 
28
  with gr.Blocks() as demo:
generators.py CHANGED
@@ -61,7 +61,7 @@ async def generate_llama2(system_input, user_input):
61
 
62
 
63
  @spaces.GPU(duration=120)
64
- async def generate_openllama(system_input, user_input):
65
  model_path = 'openlm-research/open_llama_3b_v2'
66
  tokenizer = LlamaTokenizer.from_pretrained(model_path)
67
  model = LlamaForCausalLM.from_pretrained(
@@ -75,7 +75,7 @@ async def generate_openllama(system_input, user_input):
75
 
76
 
77
  @spaces.GPU(duration=120)
78
- async def generate_bloom(system_input, user_input):
79
  model_path = 'bigscience/bloom-7b1'
80
  tokenizer = AutoTokenizer.from_pretrained(model_path)
81
  model = LlamaForCausalLM.from_pretrained(
 
61
 
62
 
63
  @spaces.GPU(duration=120)
64
+ def generate_openllama(system_input, user_input):
65
  model_path = 'openlm-research/open_llama_3b_v2'
66
  tokenizer = LlamaTokenizer.from_pretrained(model_path)
67
  model = LlamaForCausalLM.from_pretrained(
 
75
 
76
 
77
  @spaces.GPU(duration=120)
78
+ def generate_bloom(system_input, user_input):
79
  model_path = 'bigscience/bloom-7b1'
80
  tokenizer = AutoTokenizer.from_pretrained(model_path)
81
  model = LlamaForCausalLM.from_pretrained(