[misc]refactor Platform.set_device method (#20262)

Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
Kunshang Ji
2025-07-09 01:39:47 +00:00
committed by GitHub
parent 5eaf570050
commit 0b407479ef
9 changed files with 43 additions and 4 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ class Worker(WorkerBase):
# This env var set by Ray causes exceptions with graph building.
os.environ.pop("NCCL_ASYNC_ERROR_HANDLING", None)
self.device = torch.device(f"cuda:{self.local_rank}")
torch.cuda.set_device(self.device)
current_platform.set_device(self.device)
_check_if_gpu_supports_dtype(self.model_config.dtype)
gc.collect()