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

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +2 -2
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=0
142
  )
143
  self._processor = AutoProcessor.from_pretrained(self.model_name)
144
 
@@ -201,7 +201,7 @@ 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="cuda:1",
205
  model_kwargs={"torch_dtype": "auto"},
206
  generate_kwargs={"do_sample": False}
207
  )
 
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='balanced'
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:0",
205
  model_kwargs={"torch_dtype": "auto"},
206
  generate_kwargs={"do_sample": False}
207
  )