Skip to content

Fix the print of logging in distributed programs #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@


def evaluate(args):
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
if args.local_rank == 0 and not os.path.exists(args.dir):
# create 16 random image, mask paris for evaluation
print(f"generating synthetic data to {args.dir} (this may take a while)")
Expand Down Expand Up @@ -149,7 +150,6 @@ def evaluate(args):
),
]
if dist.get_rank() == 0:
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
val_handlers.extend(
[
StatsHandler(output_transform=lambda x: None),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@


def train(args):
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
if args.local_rank == 0 and not os.path.exists(args.dir):
# create 40 random image, mask paris for training
print(f"generating synthetic data to {args.dir} (this may take a while)")
Expand Down Expand Up @@ -160,7 +161,6 @@ def train(args):
LrScheduleHandler(lr_scheduler=lr_scheduler, print_lr=True),
]
if dist.get_rank() == 0:
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
train_handlers.extend(
[
StatsHandler(tag_name="train_loss", output_transform=lambda x: x["loss"]),
Expand Down