修改ddp python -m a.b.c 启动时的错误

This commit is contained in:
x54-729 2022-10-17 16:16:27 +08:00
parent 3aed436bb7
commit 24ca2851bb
2 changed files with 2 additions and 2 deletions

View File

@ -83,7 +83,7 @@ class FleetLauncher:
# use the same python interpreter and actually running
command = [sys.executable] + command
else: # Script called as `python -m a.b.c`
command = [sys.executable, "-m", __main__.__spec__._name] + sys.argv[1:]
command = [sys.executable, "-m", __main__.__spec__.name] + sys.argv[1:]
current_env = copy.copy(self.global_envs)
for idx, t in enumerate(self.sub_trainers):

View File

@ -425,7 +425,7 @@ class TorchDDPDriver(TorchDriver):
command = [sys.executable] + command
# Script called as `python -m a.b.c`
else:
command = [sys.executable, "-m", __main__.__spec__._name] + sys.argv[1:]
command = [sys.executable, "-m", __main__.__spec__.name] + sys.argv[1:]
os.environ['MASTER_ADDR'] = self.master_address
os.environ['MASTER_PORT'] = self.master_port