为什么Pytork Mask RCNN报告运行时错误?

2024-04-20 09:19:40 发布

您现在位置:Python中文网/ 问答频道 /正文

当我从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.

我怎样才能解决这个问题?你知道吗


Tags: model错误withbeoptimizerbutampinternal