refactor : 移除 LocalStrategy._clear_env 冗余清理

- setup_parallel 已覆盖所有环境变量写入,无需前置清空
This commit is contained in:
ViperEkura 2026-06-02 11:38:53 +08:00
parent 9b416c1bbb
commit 0422d6d38e
1 changed files with 0 additions and 13 deletions

View File

@ -164,20 +164,7 @@ class TorchrunStrategy(LaunchStrategy):
class LocalStrategy(LaunchStrategy): class LocalStrategy(LaunchStrategy):
"""Local launcher — single-process or mp.start_processes.""" """Local launcher — single-process or mp.start_processes."""
def _clear_env(self):
for key in (
"MASTER_ADDR",
"MASTER_PORT",
"RANK",
"WORLD_SIZE",
"LOCAL_RANK",
"LOCAL_DEVICE",
):
os.environ.pop(key, None)
def launch(self, func: Callable, **kwargs): def launch(self, func: Callable, **kwargs):
self._clear_env()
args = ( args = (
self.world_size, self.world_size,
self.backend, self.backend,