Spaces:
Runtime error
Runtime error
mrfakename
commited on
Commit
•
47cac43
1
Parent(s):
f98ecfc
Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
21 |
).to(device)
|
22 |
@spaces.GPU(enable_queue=True)
|
23 |
def generate_text(text, temperature, maxLen):
|
|
|
24 |
inputs = tokenizer([text], return_tensors="pt").to(device)
|
25 |
streamer = TextIteratorStreamer(tokenizer)
|
26 |
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=maxLen, temperature=temperature)
|
|
|
21 |
).to(device)
|
22 |
@spaces.GPU(enable_queue=True)
|
23 |
def generate_text(text, temperature, maxLen):
|
24 |
+
text = text.strip().strip('<s>').strip()
|
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)
|