[Bugfix][Ray] Set the cuda context eagerly in the ray worker (#19583)

This commit is contained in:
kourosh hakhamaneshi
2025-06-19 22:01:16 -07:00
committed by GitHub
parent e3a3e4db46
commit 5e666f72cd
4 changed files with 107 additions and 0 deletions
+7
View File
@@ -298,6 +298,13 @@ class Platform:
np.random.seed(seed)
torch.manual_seed(seed)
@classmethod
def set_device(cls, device: torch.device) -> None:
"""
Set the device for the current platform.
"""
torch.cuda.set_device(device)
@classmethod
def pre_register_and_update(cls,
parser: Optional[FlexibleArgumentParser] = None