Spaces:
Runtime error
Runtime error
mrfakename
commited on
Commit
•
399784d
1
Parent(s):
47cac43
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
21 |
).to(device)
|
22 |
@spaces.GPU(enable_queue=True)
|
23 |
def generate_text(text, temperature, maxLen):
|
24 |
-
text = text.
|
25 |
inputs = tokenizer([text], return_tensors="pt").to(device)
|
26 |
streamer = TextIteratorStreamer(tokenizer)
|
27 |
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=maxLen, temperature=temperature)
|
@@ -31,6 +31,7 @@ def generate_text(text, temperature, maxLen):
|
|
31 |
toks = 0
|
32 |
for out in streamer:
|
33 |
t += out
|
|
|
34 |
yield t
|
35 |
with gr.Blocks(theme=theme) as demo:
|
36 |
gr.Markdown("""
|
|
|
21 |
).to(device)
|
22 |
@spaces.GPU(enable_queue=True)
|
23 |
def generate_text(text, temperature, maxLen):
|
24 |
+
text = text.lstrip().lstrip('<s>').lstrip()
|
25 |
inputs = tokenizer([text], return_tensors="pt").to(device)
|
26 |
streamer = TextIteratorStreamer(tokenizer)
|
27 |
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=maxLen, temperature=temperature)
|
|
|
31 |
toks = 0
|
32 |
for out in streamer:
|
33 |
t += out
|
34 |
+
t = t.lstrip().lstrip('<s>').lstrip()
|
35 |
yield t
|
36 |
with gr.Blocks(theme=theme) as demo:
|
37 |
gr.Markdown("""
|