dwb2023 commited on
Commit
6b0243b
·
verified ·
1 Parent(s): fe3c5cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ from transformers import TextIteratorStreamer, AutoTokenizer, AutoModelForCausal
8
  import subprocess
9
  # subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
10
 
11
- device = torch.device("cpu")
12
  dtype = torch.float32
13
 
14
  model_id = "vikhyatk/moondream2"
@@ -20,7 +20,7 @@ moondream = AutoModelForCausalLM.from_pretrained(
20
  moondream.eval()
21
 
22
 
23
- @spaces.CPU(duration=60)
24
  def answer_question(img, prompt):
25
  image_embeds = moondream.encode_image(img)
26
  streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=True)
 
8
  import subprocess
9
  # subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
10
 
11
+ device = torch.device("cuda")
12
  dtype = torch.float32
13
 
14
  model_id = "vikhyatk/moondream2"
 
20
  moondream.eval()
21
 
22
 
23
+ @spaces.GPU(duration=60)
24
  def answer_question(img, prompt):
25
  image_embeds = moondream.encode_image(img)
26
  streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=True)