Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Fix mp_eval. Support dumping parallel logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenroller committed Jul 15, 2020
1 parent 1aef411 commit c9094b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 1 addition & 4 deletions parlai/scripts/distributed_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
-m seq2seq -t convai2 --dict-file /path/to/dict-file
"""

import os

import parlai.scripts.train_model as single_train
import parlai.utils.logging as logging
from parlai.scripts.script import ParlaiScript
import parlai.utils.distributed as distributed_utils

Expand All @@ -52,7 +49,7 @@ def setup_args(cls):
return setup_args()

def run(self):
with distributed_utils.slurm_distributed_context(opt) as opt:
with distributed_utils.slurm_distributed_context(self.opt) as opt:
return single_train.TrainLoop(opt).train_model()


Expand Down
8 changes: 6 additions & 2 deletions parlai/scripts/eval_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
is_primary_worker,
all_gather_list,
is_distributed,
sync_object,
get_rank,
)


Expand Down Expand Up @@ -162,7 +162,11 @@ def _eval_single_world(opt, agent, task):
# dump world acts to file
world_logger.reset() # add final acts to logs
base_outfile = opt['report_filename'].split('.')[0]
outfile = base_outfile + f'_{task}_replies.jsonl'
if is_distributed():
rank = get_rank()
outfile = base_outfile + f'_{task}_{rank}_replies.jsonl'
else:
outfile = base_outfile + f'_{task}_replies.jsonl'
world_logger.write(outfile, world, file_format=opt['save_format'])

return report
Expand Down

0 comments on commit c9094b9

Please sign in to comment.