Coool2 commited on
Commit
5d36f6f
·
1 Parent(s): 4d84d69

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +5 -6
agent.py CHANGED
@@ -138,7 +138,7 @@ def initialize_models(use_api_mode=False):
138
  def __init__(self, **kwargs):
139
  super().__init__(**kwargs)
140
  self._model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
141
- self.model_name, torch_dtype=torch.bfloat16, device_map="auto"
142
  )
143
  self._processor = AutoProcessor.from_pretrained(self.model_name)
144
 
@@ -201,17 +201,16 @@ def initialize_models(use_api_mode=False):
201
  code_llm = HuggingFaceLLM(
202
  model_name="Qwen/Qwen2.5-Coder-3B-Instruct",
203
  tokenizer_name="Qwen/Qwen2.5-Coder-3B-Instruct",
204
- device_map="auto",
205
  model_kwargs={"torch_dtype": "auto"},
206
  generate_kwargs={"do_sample": False}
207
  )
208
 
209
  # Embedding model
210
  embed_model = HuggingFaceEmbedding(
211
- model_name="llamaindex/vdr-2b-multi-v1",
212
- device="cpu",
213
- trust_remote_code=True,
214
- backend="openvino")
215
 
216
  return proj_llm, code_llm, embed_model
217
  except Exception as e:
 
138
  def __init__(self, **kwargs):
139
  super().__init__(**kwargs)
140
  self._model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
141
+ self.model_name, torch_dtype=torch.bfloat16, device_map=0
142
  )
143
  self._processor = AutoProcessor.from_pretrained(self.model_name)
144
 
 
201
  code_llm = HuggingFaceLLM(
202
  model_name="Qwen/Qwen2.5-Coder-3B-Instruct",
203
  tokenizer_name="Qwen/Qwen2.5-Coder-3B-Instruct",
204
+ device_map="cuda:1",
205
  model_kwargs={"torch_dtype": "auto"},
206
  generate_kwargs={"do_sample": False}
207
  )
208
 
209
  # Embedding model
210
  embed_model = HuggingFaceEmbedding(
211
+ model_name="nomic-ai/colnomic-embed-multimodal-3b",
212
+ device="cuda:1",
213
+ trust_remote_code=True)
 
214
 
215
  return proj_llm, code_llm, embed_model
216
  except Exception as e: