diff --git a/yolov6/core/inferer.py b/yolov6/core/inferer.py index a7f3f7c6..cea6586d 100644 --- a/yolov6/core/inferer.py +++ b/yolov6/core/inferer.py @@ -62,6 +62,8 @@ def model_switch(self, model, img_size): for layer in model.modules(): if isinstance(layer, RepVGGBlock): layer.switch_to_deploy() + elif isinstance(layer, torch.nn.Upsample) and not hasattr(layer, 'recompute_scale_factor'): + layer.recompute_scale_factor = None # torch 1.11.0 compatibility LOGGER.info("Switch model to deploy modality.")