Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,10 @@ prompt = st.text_area("Enter a prompt:", "this news is real pyresearch given rig
|
|
12 |
|
13 |
# Load model and tokenizer
|
14 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
15 |
-
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-2", torch_dtype="auto",
|
|
|
|
|
|
|
16 |
|
17 |
# Generate text on button click
|
18 |
if st.button("Generate"):
|
|
|
12 |
|
13 |
# Load model and tokenizer
|
14 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
15 |
+
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-2", torch_dtype="auto", trust_remote_code=True)
|
16 |
+
|
17 |
+
# Move the model to the desired device
|
18 |
+
model.to(device)
|
19 |
|
20 |
# Generate text on button click
|
21 |
if st.button("Generate"):
|