sitammeur commited on
Commit
2924bfa
·
verified ·
1 Parent(s): 88211cc

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +5 -3
model.py CHANGED
@@ -9,7 +9,10 @@ device = "cuda"
9
 
10
  # Load the model and tokenizer
11
  model = AutoModel.from_pretrained(
12
- "openbmb/MiniCPM-V-2_6", trust_remote_code=True, attn_implementation='sdpa', torch_dtype=torch.bfloat16
 
 
 
13
  )
14
  model = model.to(device=device)
15
  tokenizer = AutoTokenizer.from_pretrained(
@@ -22,11 +25,10 @@ model.eval()
22
  def answer_question(image, question):
23
  """
24
  Generates an answer to a given question based on the provided image and question.
25
-
26
  Args:
27
  - image (str): The path to the image file.
28
  - question (str): The question text.
29
-
30
  Returns:
31
  str: The generated answer to the question.
32
  """
 
9
 
10
  # Load the model and tokenizer
11
  model = AutoModel.from_pretrained(
12
+ "openbmb/MiniCPM-V-2_6",
13
+ trust_remote_code=True,
14
+ attn_implementation="sdpa",
15
+ torch_dtype=torch.bfloat16,
16
  )
17
  model = model.to(device=device)
18
  tokenizer = AutoTokenizer.from_pretrained(
 
25
  def answer_question(image, question):
26
  """
27
  Generates an answer to a given question based on the provided image and question.
28
+
29
  Args:
30
  - image (str): The path to the image file.
31
  - question (str): The question text.
 
32
  Returns:
33
  str: The generated answer to the question.
34
  """