Csplk commited on
Commit
da6e213
Β·
1 Parent(s): b879220

trying to fix

Browse files
Files changed (2) hide show
  1. app.py +21 -6
  2. requirements.txt +2 -1
app.py CHANGED
@@ -12,15 +12,30 @@ import subprocess
12
 
13
  #subprocess.run('cp -r moondream/torch clients/python/moondream/torch')
14
  #subprocess.run('pip install moondream[gpu]')
15
- model_id = "vikhyatk/moondream2"
16
- revision = "2025-01-09"
17
- tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
 
 
 
 
 
 
 
18
  moondream = AutoModelForCausalLM.from_pretrained(
19
- model_id, trust_remote_code=True, revision=revision,
20
- torch_dtype=torch.bfloat16, device_map={"": "cuda"},
21
  )
 
 
 
 
 
 
 
 
 
22
 
23
- moondream.eval()
24
 
25
  @spaces.GPU(durtion="150")
26
  def answer_questions(image_tuples, prompt_text):
 
12
 
13
  #subprocess.run('cp -r moondream/torch clients/python/moondream/torch')
14
  #subprocess.run('pip install moondream[gpu]')
15
+
16
+ #def load_moondream():
17
+ # """Load Moondream model and tokenizer."""
18
+ # model = AutoModelForCausalLM.from_pretrained(
19
+ # "vikhyatk/moondream2", trust_remote_code=True, device_map={"": "cuda"}
20
+ # )
21
+ # tokenizer = AutoTokenizer.from_pretrained("vikhyatk/moondream2")
22
+ # return model, tokenizer
23
+
24
+ """Load Moondream model and tokenizer."""
25
  moondream = AutoModelForCausalLM.from_pretrained(
26
+ "vikhyatk/moondream2", trust_remote_code=True, device_map={"": "cuda"}
 
27
  )
28
+ tokenizer = AutoTokenizer.from_pretrained("vikhyatk/moondream2")
29
+
30
+ #model_id = "vikhyatk/moondream2"
31
+ #revision = "2025-01-09"
32
+ #tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
33
+ #moondream = AutoModelForCausalLM.from_pretrained(
34
+ # model_id, trust_remote_code=True, revision=revision,
35
+ # torch_dtype=torch.bfloat16, device_map={"": "cuda"},
36
+ #)
37
 
38
+ #moondream.eval()
39
 
40
  @spaces.GPU(durtion="150")
41
  def answer_questions(image_tuples, prompt_text):
requirements.txt CHANGED
@@ -1,7 +1,8 @@
 
1
  timm
2
  transformers
3
  einops
4
  accelerate
5
  torch
6
- pyvips
7
  pyvips-binary
 
 
1
+ spaces
2
  timm
3
  transformers
4
  einops
5
  accelerate
6
  torch
 
7
  pyvips-binary
8
+ pyvips