Skip to content

Commit 9c4929f

Browse files
authored
fix device_map (#505)
1 parent b1fbf55 commit 9c4929f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lmms_eval/models/internvl2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ def __init__(
204204
self._device = torch.device(f"cuda:{accelerator.local_process_index}")
205205
self.device_map = f"cuda:{accelerator.local_process_index}"
206206

207-
self._model = AutoModel.from_pretrained(self.path, torch_dtype=torch.bfloat16, low_cpu_mem_usage=True, trust_remote_code=True, device_map=device_map).eval()
208-
self._tokenizer = AutoTokenizer.from_pretrained(self.path, trust_remote_code=True, device_map=device_map)
207+
self._model = AutoModel.from_pretrained(self.path, torch_dtype=torch.bfloat16, low_cpu_mem_usage=True, trust_remote_code=True, device_map=self.device_map).eval()
208+
self._tokenizer = AutoTokenizer.from_pretrained(self.path, trust_remote_code=True, device_map=self.device_map)
209209

210210
if accelerator.num_processes > 1:
211211
assert accelerator.distributed_type in [DistributedType.FSDP, DistributedType.MULTI_GPU, DistributedType.DEEPSPEED], "Unsupported distributed type provided. Only DDP and FSDP are supported."

lmms_eval/models/qwen2_audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(
5858
self._model = Qwen2AudioForConditionalGeneration.from_pretrained(
5959
pretrained,
6060
torch_dtype="auto",
61-
device_map=device_map,
61+
device_map=self.device_map,
6262
).eval()
6363

6464
self.processor = AutoProcessor.from_pretrained(pretrained)

0 commit comments

Comments
 (0)