Skip to content
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

Error during training #6

Open
o0t1ng0o opened this issue Sep 2, 2023 · 0 comments
Open

Error during training #6

o0t1ng0o opened this issue Sep 2, 2023 · 0 comments

Comments

@o0t1ng0o
Copy link

o0t1ng0o commented Sep 2, 2023

Hi @LX-doctorAI1 ,
Thank you for sharing this code.
I met this error during training. It seems that it occurs when 'n=0'.
Could you give some advice?
Thank you in advance!

0%| | 0/13409 [00:02<?, ?it/s]
Traceback (most recent call last):
File "main.py", line 57, in
main()
File "main.py", line 52, in main
trainer.train()
File "/apdcephfs_cq2/share_916081/jarviswang/wt/code/medical_report_gen/M2KT/modules/trainer.py", line 67, in train
result = self._train_epoch(epoch)
File "/apdcephfs_cq2/share_916081/jarviswang/wt/code/medical_report_gen/M2KT/modules/trainer.py", line 285, in _train_epoch
loss = self.criterion(*((outputs[0],) + (reports_ids, reports_masks, labels) + outputs[1:] + (self.args,)))
File "/apdcephfs_cq2/share_916081/jarviswang/wt/code/medical_report_gen/M2KT/modules/loss.py", line 68, in compute_loss
match_loss = ranking_loss(z_img, z_txt, labels, similarity_function)
File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/apdcephfs_cq2/share_916081/jarviswang/wt/code/medical_report_gen/M2KT/modules/loss.py", line 78, in forward
return self.imposter_img_loss(z_image, z_text, labels, similarity_function) +
File "/apdcephfs_cq2/share_916081/jarviswang/wt/code/medical_report_gen/M2KT/modules/loss.py", line 103, in imposter_img_loss
margin = max(0.5, diff / n)
ZeroDivisionError: division by zero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant