tonytan48 / KD-DocRE

Implementation of Document-level Relation Extraction with Knowledge Distillation and Adaptive Focal Loss
110 stars 20 forks source link

I got the problem about "ZeroDivisionError: float division by zero" #11

Closed WilliamAntoniocrayon closed 2 years ago

WilliamAntoniocrayon commented 2 years ago

Hi, I got the problem which is "ZeroDivisionError: float division by zero" while I run the step3 with "bash scripts/knowledge_distill_bert.sh " image

I'm confused about that.

tonytan48 commented 2 years ago

Hi there, Thank you for your interest. May I know is this bug always the case? or it doest not pop up for some other random seeds. It seems that this bug originates from apex's operation. We used apex-0.1 from and built from their github repository.

WilliamAntoniocrayon commented 2 years ago

Yes, you are right. The problem lies in the apex.It is solved after I changed "out_scale/grads_have_scale" to "out_scale/(grads_have_scale+float(”1e-8”))"