Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
def generate_primes(text_input):
|
| 4 |
inputs = tokenizer(text_input, return_tensors="pt", return_attention_mask=False)
|
| 5 |
outputs = model.generate(**inputs, max_length=200)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
torch.set_default_device("cuda")
|
| 4 |
+
|
| 5 |
+
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-2", torch_dtype="auto", trust_remote_code=True)
|
| 6 |
+
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
def generate_primes(text_input):
|
| 10 |
inputs = tokenizer(text_input, return_tensors="pt", return_attention_mask=False)
|
| 11 |
outputs = model.generate(**inputs, max_length=200)
|