jaymojnidar commited on
Commit
1cb615a
1 Parent(s): 2a78417

hmm... putting back the cuda

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. model.py +2 -2
app.py CHANGED
@@ -32,8 +32,8 @@ As a derivate work of [Llama-2-7b-chat](https://huggingface.co/meta-llama/Llama-
32
  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).
33
  """
34
 
35
- if torch.cuda.is_available():
36
- DESCRIPTION += '\n<p>Running on GPU 🥶 Do not use GPU $$.</p>'
37
 
38
 
39
  def clear_and_save_textbox(message: str) -> tuple[str, str]:
 
32
  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).
33
  """
34
 
35
+ if not torch.cuda.is_available():
36
+ DESCRIPTION += '\n<p>Running on GPU 🥶 Do not use CPU.</p>'
37
 
38
 
39
  def clear_and_save_textbox(message: str) -> tuple[str, str]:
model.py CHANGED
@@ -9,7 +9,7 @@ from huggingface_hub import login
9
  # model_id = 'meta-llama/Llama-2-13b-chat-hf'
10
  model_id = 'meta-llama/Llama-2-7b-chat-hf'
11
 
12
- if not torch.cuda.is_available():
13
  tok = os.environ['HF_TOKEN']
14
  login(new_session=True,
15
  write_permission=False,
@@ -62,7 +62,7 @@ def run(message: str,
62
  top_p: float = 0.95,
63
  top_k: int = 50) -> Iterator[str]:
64
  prompt = get_prompt(message, chat_history, system_prompt)
65
- inputs = tokenizer([prompt], return_tensors='pt', add_special_tokens=False) #.to(torch.device) #.to('cuda')
66
 
67
  streamer = TextIteratorStreamer(tokenizer,
68
  timeout=10.,
 
9
  # model_id = 'meta-llama/Llama-2-13b-chat-hf'
10
  model_id = 'meta-llama/Llama-2-7b-chat-hf'
11
 
12
+ if torch.cuda.is_available():
13
  tok = os.environ['HF_TOKEN']
14
  login(new_session=True,
15
  write_permission=False,
 
62
  top_p: float = 0.95,
63
  top_k: int = 50) -> Iterator[str]:
64
  prompt = get_prompt(message, chat_history, system_prompt)
65
+ inputs = tokenizer([prompt], return_tensors='pt', add_special_tokens=False).to('cuda') #.to(torch.device) #
66
 
67
  streamer = TextIteratorStreamer(tokenizer,
68
  timeout=10.,