Skip to content

Commit

Permalink
Refine error message (open-mmlab#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouzaida authored Sep 4, 2023
1 parent 5671b53 commit 8c934d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/distributed_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def main():
collate_fn=dict(type='default_collate'))
runner = Runner(
model=MMResNet50(),
work_dir='./work_dir',
work_dir='./work_dirs',
train_dataloader=train_dataloader,
optim_wrapper=dict(optimizer=dict(type=SGD, lr=0.001, momentum=0.9)),
train_cfg=dict(by_epoch=True, max_epochs=2, val_interval=1),
Expand Down
9 changes: 6 additions & 3 deletions mmengine/utils/progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def track_progress(func: Callable,
task_num = len(tasks)
else:
raise TypeError(
'"tasks" must be an iterable object or a (iterator, int) tuple')
'"tasks" must be an iterable object or a (iterator, int) tuple, '
f'but got {type(tasks)}')
prog_bar = ProgressBar(task_num, bar_width, file=file)
results = []
for task in tasks:
Expand Down Expand Up @@ -181,7 +182,8 @@ def track_parallel_progress(func: Callable,
task_num = len(tasks)
else:
raise TypeError(
'"tasks" must be an iterable object or a (iterator, int) tuple')
'"tasks" must be an iterable object or a (iterator, int) tuple, '
f'but got {type(tasks)}')
pool = init_pool(nproc, initializer, initargs)
start = not skip_first
task_num -= nproc * chunksize * int(skip_first)
Expand Down Expand Up @@ -232,7 +234,8 @@ def track_iter_progress(tasks: Union[list, Iterable],
task_num = len(tasks)
else:
raise TypeError(
'"tasks" must be an iterable object or a (iterator, int) tuple')
'"tasks" must be an iterable object or a (iterator, int) tuple, '
f'but got {type(tasks)}')
prog_bar = ProgressBar(task_num, bar_width, file=file)
for task in tasks:
yield task
Expand Down

0 comments on commit 8c934d2

Please sign in to comment.