当我从https://github.com/facebookresearch/maskrcnn-benchmark运行Mask RCNN时,出现此错误:
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`.
当我添加
model, optimizer = amp.initialize(model, optimizer, opt_level="O0")
在amp.scale_loss
之前,出现此错误:
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.
我该如何解决这个问题?