zhjohnchan / R2GenCMN

[ACL-2021] The official implementation of Cross-modal Memory Networks for Radiology Report Generation.
Apache License 2.0
77 stars 7 forks source link

how to set my num_workers value? #2

Closed JoshSmith0118 closed 2 years ago

JoshSmith0118 commented 2 years ago

hi thx for your code, but when I run your code on my m1 mac by CPU, I stuck in there BrokenPipeError: [Errno 32] Broken pipe then I google it, and someone said it might be the num_workers problem. https://blog.csdn.net/qq_33666011/article/details/81873217 Do you know how to solve this problem? thanks for your attention

zhjohnchan commented 2 years ago

Hi there,

You can set the num_workers by changing this argument.

Best, Zhihong

JoshSmith0118 commented 2 years ago

thanks for your reply, I did as you said, but the result still as follow:

/Users/shihaozhe/R2GenCMN-main/modules/caption_model.py:73: UserWarning: floordiv is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor'). beam_ix = ix // vocab_size # Nxb which beam {'testlen': 7517, 'reflen': 10304, 'guess': [7517, 7221, 6925, 6629], 'correct': [4286, 1655, 875, 503]} ratio: 0.7295225155278795 Traceback (most recent call last): File "/Users/shihaozhe/R2GenCMN-main/main_train.py", line 136, in main() File "/Users/shihaozhe/R2GenCMN-main/main_train.py", line 132, in main trainer.train() File "/Users/shihaozhe/R2GenCMN-main/modules/trainer.py", line 58, in train result = self._train_epoch(epoch) File "/Users/shihaozhe/R2GenCMN-main/modules/trainer.py", line 207, in _train_epoch val_met = self.metric_ftns({i: [gt] for i, gt in enumerate(val_gts)}, File "/Users/shihaozhe/R2GenCMN-main/modules/metrics.py", line 27, in compute_scores score, scores = scorer.compute_score(gts, res) File "/Users/shihaozhe/R2GenCMN-main/pycocoevalcap/meteor/meteor.py", line 43, in compute_score stat = self._stat(res[i][0], gts[i]) File "/Users/shihaozhe/R2GenCMN-main/pycocoevalcap/meteor/meteor.py", line 61, in _stat self.meteor_p.stdin.write('{}\n'.format(score_line)) BrokenPipeError: [Errno 32] Broken pipe

zhjohnchan commented 2 years ago

Java 1.8.0 is needed for METEOR. Please install it.

JoshSmith0118 commented 2 years ago

Thanks a lot, the problem has been solved.