Update app.py
Browse files
app.py
CHANGED
|
@@ -22,13 +22,13 @@ class _MLPVectorProjector(nn.Module):
|
|
| 22 |
|
| 23 |
model_name = "microsoft/phi-2"
|
| 24 |
|
| 25 |
-
phi2_text = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 27 |
|
| 28 |
|
| 29 |
def textMode(text, count):
|
| 30 |
count = int(count)
|
| 31 |
-
inputs = tokenizer(text, return_tensors="pt")
|
| 32 |
prediction = tokenizer.batch_decode(
|
| 33 |
phi2_text.generate(
|
| 34 |
**inputs,
|
|
|
|
| 22 |
|
| 23 |
model_name = "microsoft/phi-2"
|
| 24 |
|
| 25 |
+
phi2_text = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", trust_remote_code=True)
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 27 |
|
| 28 |
|
| 29 |
def textMode(text, count):
|
| 30 |
count = int(count)
|
| 31 |
+
inputs = tokenizer(text, return_tensors="pt", return_attention_mask=False)
|
| 32 |
prediction = tokenizer.batch_decode(
|
| 33 |
phi2_text.generate(
|
| 34 |
**inputs,
|