Skip to content

Commit

Permalink
fix device_map (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-famer authored Jan 23, 2025
1 parent b1fbf55 commit 9c4929f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lmms_eval/models/internvl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ def __init__(
self._device = torch.device(f"cuda:{accelerator.local_process_index}")
self.device_map = f"cuda:{accelerator.local_process_index}"

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()
self._tokenizer = AutoTokenizer.from_pretrained(self.path, trust_remote_code=True, device_map=device_map)
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()
self._tokenizer = AutoTokenizer.from_pretrained(self.path, trust_remote_code=True, device_map=self.device_map)

if accelerator.num_processes > 1:
assert accelerator.distributed_type in [DistributedType.FSDP, DistributedType.MULTI_GPU, DistributedType.DEEPSPEED], "Unsupported distributed type provided. Only DDP and FSDP are supported."
Expand Down
2 changes: 1 addition & 1 deletion lmms_eval/models/qwen2_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
self._model = Qwen2AudioForConditionalGeneration.from_pretrained(
pretrained,
torch_dtype="auto",
device_map=device_map,
device_map=self.device_map,
).eval()

self.processor = AutoProcessor.from_pretrained(pretrained)
Expand Down

0 comments on commit 9c4929f

Please sign in to comment.