QueryDet-PyTorch
QueryDet-PyTorch copied to clipboard
Hello,when i run the train_coco.py,i came across a bug:'AttributeError: 'Trainer' object has no attribute '_detect_anomaly',could you help me?
Traceback (most recent call last):
File "train_coco.py", line 15, in
I meet the same problem...
你用的apex的版本是什么,跟作者的一样吗
I met the same problem. The problem is that the version number of detectron2 should be 0.2.1. Some versions of detectron2 delete the _ detect_anomaly from the Class SimpleTrainer, such as detectron2 in version 3.0.
Therefore, it is recommended that you install detectron2 version 0.2.1
Installation link: https://github.com/facebookresearch/detectron2/releases
thank you for your reply.I once suspected that it was the version of detection2, but since the computer's graphics card is 30 series, only version 3.0 of detection2 is supported at least.Your answer confirmed my suspicions.
thank you for your reply.I once suspected that it was the version of detection2, but since the computer's graphics card is 30 series, only version 3.0 of detection2 is supported at least.Your answer confirmed my suspicions.
You can still circumvent this issue by adding the following function inside the ApexTrainer class:
def _detect_anomaly(self, losses, loss_dict):
if not torch.isfinite(losses).all():
raise FloatingPointError(
"Loss became infinite or NaN at iteration={}!\nloss_dict = {}".format(
self.iter, loss_dict
)
)
Hi, this problem is caused by the APEX library. We have recently updated the whole repository, and you do not need APEX any more.