When I run the Mask RCNN from https://github.com/facebookresearch/maskrcnn-benchmark I get this error:

raise RuntimeError("Invoked 'with amp.scale_loss`, but internal Amp state has not been initialized.  "
RuntimeError: Invoked 'with amp.scale_loss`, but internal Amp state has not been initialized.  model, optimizer = amp.initialize(model, optimizer, opt_level=...) must be called before `with amp.scale_loss`.

When I add the

model, optimizer = amp.initialize(model, optimizer, opt_level="O0")

before the amp.scale_loss, I get this error:

raise RuntimeError("A given optimizer should only be passed through amp.initialize once.")
RuntimeError: A given optimizer should only be passed through amp.initialize once.

How can I solve this problem?

0 Answers