Spaces:
Sleeping
Sleeping
Benjamin Gonzalez
commited on
Commit
Β·
c298b11
1
Parent(s):
bc609bc
switch to cpu
Browse files- README.md +1 -1
- app.py +1 -1
- pre-requirements.txt +1 -1
README.md
CHANGED
@@ -3,7 +3,7 @@ title: Phi 2
|
|
3 |
emoji: π
|
4 |
colorFrom: green
|
5 |
colorTo: purple
|
6 |
-
sdk:
|
7 |
sdk_version: 1.29.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
3 |
emoji: π
|
4 |
colorFrom: green
|
5 |
colorTo: purple
|
6 |
+
sdk: gradio
|
7 |
sdk_version: 1.29.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
app.py
CHANGED
@@ -3,7 +3,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
3 |
import gradio as gr
|
4 |
|
5 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
6 |
-
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-2", torch_dtype=
|
7 |
|
8 |
def generate(prompt, length):
|
9 |
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False)
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
6 |
+
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-2", torch_dtype=torch.float32, device_map="cpu", trust_remote_code=True)
|
7 |
|
8 |
def generate(prompt, length):
|
9 |
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False)
|
pre-requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
--extra-index-url https://download.pytorch.org/whl/
|
2 |
torch==2.1.0
|
3 |
wheel
|
|
|
1 |
+
--extra-index-url https://download.pytorch.org/whl/cpu
|
2 |
torch==2.1.0
|
3 |
wheel
|