jaymojnidar commited on
Commit
a0100cd
1 Parent(s): 20a425d

resetting it to use CPU

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. model.py +2 -2
app.py CHANGED
@@ -30,9 +30,10 @@ As a derivate work of [Llama-2-13b-chat](https://huggingface.co/meta-llama/Llama
30
  this demo is governed by the original [license](https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat/blob/main/LICENSE.txt) and [acceptable use policy](https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat/blob/main/USE_POLICY.md).
31
  """
32
 
 
33
  if not torch.cuda.is_available():
34
  DESCRIPTION += '\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>'
35
-
36
 
37
  def clear_and_save_textbox(message: str) -> tuple[str, str]:
38
  return '', message
 
30
  this demo is governed by the original [license](https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat/blob/main/LICENSE.txt) and [acceptable use policy](https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat/blob/main/USE_POLICY.md).
31
  """
32
 
33
+ '''
34
  if not torch.cuda.is_available():
35
  DESCRIPTION += '\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>'
36
+ '''
37
 
38
  def clear_and_save_textbox(message: str) -> tuple[str, str]:
39
  return '', message
model.py CHANGED
@@ -8,7 +8,7 @@ from huggingface_hub import login
8
 
9
  model_id = 'jaymojnidar/Llama-2-7b-chat-hf-sharded-bf16-5GBMAX'
10
 
11
- if torch.cuda.is_available():
12
  tok = os.environ['HF_TOKEN']
13
  login(new_session=True,
14
  write_permission=False,
@@ -61,7 +61,7 @@ def run(message: str,
61
  top_p: float = 0.95,
62
  top_k: int = 50) -> Iterator[str]:
63
  prompt = get_prompt(message, chat_history, system_prompt)
64
- inputs = tokenizer([prompt], return_tensors='pt', add_special_tokens=False).to('cuda')
65
 
66
  streamer = TextIteratorStreamer(tokenizer,
67
  timeout=10.,
 
8
 
9
  model_id = 'jaymojnidar/Llama-2-7b-chat-hf-sharded-bf16-5GBMAX'
10
 
11
+ if not torch.cuda.is_available():
12
  tok = os.environ['HF_TOKEN']
13
  login(new_session=True,
14
  write_permission=False,
 
61
  top_p: float = 0.95,
62
  top_k: int = 50) -> Iterator[str]:
63
  prompt = get_prompt(message, chat_history, system_prompt)
64
+ inputs = tokenizer([prompt], return_tensors='pt', add_special_tokens=False).to(torch.device) #.to('cuda')
65
 
66
  streamer = TextIteratorStreamer(tokenizer,
67
  timeout=10.,