Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ model = PeftModel.from_pretrained(model, "Phearion/bigbrain-v0.0.1")
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
|
13 |
|
14 |
|
|
|
15 |
def greet(text):
|
16 |
batch = tokenizer(f"'{text}' ->: ", return_tensors='pt')
|
17 |
|
@@ -19,8 +20,7 @@ def greet(text):
|
|
19 |
with torch.no_grad():
|
20 |
output_tokens = model.generate(**batch, do_sample=True, max_new_tokens=20)
|
21 |
|
22 |
-
return tokenizer.decode
|
23 |
-
(output_tokens[0], skip_special_tokens=True)
|
24 |
|
25 |
|
26 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
|
13 |
|
14 |
|
15 |
+
|
16 |
def greet(text):
|
17 |
batch = tokenizer(f"'{text}' ->: ", return_tensors='pt')
|
18 |
|
|
|
20 |
with torch.no_grad():
|
21 |
output_tokens = model.generate(**batch, do_sample=True, max_new_tokens=20)
|
22 |
|
23 |
+
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
|
|
24 |
|
25 |
|
26 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|