Spaces:
Runtime error
Runtime error
shrimantasatpati
commited on
Commit
•
287e1cb
1
Parent(s):
92df928
Updated app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import streamlit as st
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
import torch
|
4 |
|
5 |
-
# torch.set_default_device("cuda")
|
6 |
# Load the Phi 2 model and tokenizer
|
7 |
tokenizer = AutoTokenizer.from_pretrained(
|
8 |
"microsoft/phi-2",
|
@@ -10,8 +9,8 @@ tokenizer = AutoTokenizer.from_pretrained(
|
|
10 |
)
|
11 |
|
12 |
model = AutoModelForCausalLM.from_pretrained(
|
13 |
-
"
|
14 |
-
device_map="cpu",
|
15 |
trust_remote_code=True,
|
16 |
torch_dtype=torch.float32
|
17 |
)
|
@@ -38,4 +37,4 @@ if st.button("Generate Output"):
|
|
38 |
|
39 |
output = tokenizer.decode(output_ids[0][token_ids.size(1):])
|
40 |
st.text("Generated Output:")
|
41 |
-
st.write(output)
|
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
import torch
|
4 |
|
|
|
5 |
# Load the Phi 2 model and tokenizer
|
6 |
tokenizer = AutoTokenizer.from_pretrained(
|
7 |
"microsoft/phi-2",
|
|
|
9 |
)
|
10 |
|
11 |
model = AutoModelForCausalLM.from_pretrained(
|
12 |
+
"kroonen/phi-2-GGUF",
|
13 |
+
# device_map="cpu",
|
14 |
trust_remote_code=True,
|
15 |
torch_dtype=torch.float32
|
16 |
)
|
|
|
37 |
|
38 |
output = tokenizer.decode(output_ids[0][token_ids.size(1):])
|
39 |
st.text("Generated Output:")
|
40 |
+
st.write(output)
|