Benjamin Gonzalez commited on
Commit
c298b11
Β·
1 Parent(s): bc609bc

switch to cpu

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +1 -1
  3. 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: streamlit
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="auto", device_map="cuda", trust_remote_code=True)
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/cu113
2
  torch==2.1.0
3
  wheel
 
1
+ --extra-index-url https://download.pytorch.org/whl/cpu
2
  torch==2.1.0
3
  wheel