prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  getting_started_object_detection.ipynb fails after CentripetalNet support merge
  ## 🐛 Bug
  **Describe the bug**
  `getting_started_object_detection.ipynb` fails to run with the following error.
  
  `AttributeError: 'VFNet' object has no attribute 'mask_head'
  `
  **To Reproduce**
  Steps to reproduce the behavior: Run the getting started notebook.
  
  **Expected behavior**
  Model should instantiate.
  
  **Screenshots**
  ![image](https://user-images.githubusercontent.com/6821286/152749230-5ebaaaee-d21e-462d-858d-26b890c95067.png)
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `icevision/models/mmdet/utils.py`
  Content:
  ```
  1 __all__ = [
  2     "MMDetBackboneConfig",
  3     "mmdet_configs_path",
  4     "param_groups",
  5     "MMDetBackboneConfig",
  6     "create_model_config",
  7 ]
  8 
  9 from icevision.imports import *
  10 from icevision.utils import *
  11 from icevision.backbones import BackboneConfig
  12 from icevision.models.mmdet.download_configs import download_mmdet_configs
  13 from mmdet.models.detectors import *
  14 from mmcv import Config
  15 from mmdet.models.backbones.ssd_vgg import SSDVGG
  16 from mmdet.models.backbones.csp_darknet import CSPDarknet
  17 from mmdet.models.backbones.swin import SwinTransformer
  18 from mmdet.models.backbones.hourglass import HourglassNet
  19 
  20 
  21 mmdet_configs_path = download_mmdet_configs()
  22 
  23 
  24 class MMDetBackboneConfig(BackboneConfig):
  25     def __init__(self, model_name, config_path, weights_url):
  26         self.model_name = model_name
  27         self.config_path = config_path
  28         self.weights_url = weights_url
  29         self.pretrained: bool
  30 
  31     def __call__(self, pretrained: bool = True) -> "MMDetBackboneConfig":
  32         self.pretrained = pretrained
  33         return self
  34 
  35 
  36 def param_groups(model):
  37     body = model.backbone
  38 
  39     layers = []
  40 
  41     # add the backbone
  42     if isinstance(body, SSDVGG):
  43         layers += [body.features]
  44     elif isinstance(body, CSPDarknet):
  45         layers += [body.stem.conv.conv, body.stem.conv.bn]
  46         layers += [body.stage1, body.stage2, body.stage3, body.stage4]
  47 
  48     elif isinstance(body, HourglassNet):
  49         layers += [
  50             body.stem,
  51             body.hourglass_modules,
  52             body.inters,
  53             body.conv1x1s,
  54             body.out_convs,
  55             body.remap_convs,
  56             body.relu,
  57         ]
  58 
  59     elif isinstance(body, SwinTransformer):
  60         layers += [
  61             body.patch_embed.adap_padding,
  62             body.patch_embed.projection,
  63             body.patch_embed.norm,
  64             body.drop_after_pos,
  65             body.stages,
  66         ]
  67         # Swin backbone for two-stage detector has norm0 attribute
  68         if getattr(body, "norm0", False):
  69             layers += [body.norm0]
  70 
  71         layers += [body.norm1, body.norm2, body.norm3]
  72     else:
  73         layers += [nn.Sequential(body.conv1, body.bn1)]
  74         layers += [getattr(body, l) for l in body.res_layers]
  75 
  76     # add the neck module if it exists (DETR doesn't have a neck module)
  77     layers += [module for name, module in model.named_modules() if name == "neck"]
  78 
  79     # add the head
  80     if isinstance(model, SingleStageDetector):
  81         layers += [model.bbox_head]
  82 
  83         # YOLACT has mask_head and segm_head
  84         if getattr(model, "mask_head"):
  85             layers += [model.mask_head]
  86         if getattr(model, "segm_head"):
  87             layers += [model.segm_head]
  88 
  89     elif isinstance(model, TwoStageDetector):
  90         layers += [nn.Sequential(model.rpn_head, model.roi_head)]
  91     else:
  92         raise RuntimeError(
  93             "{model} must inherit either from SingleStageDetector or TwoStageDetector class"
  94         )
  95 
  96     _param_groups = [list(layer.parameters()) for layer in layers]
  97     check_all_model_params_in_groups2(model, _param_groups)
  98     return _param_groups
  99 
  100 
  101 def create_model_config(
  102     backbone: MMDetBackboneConfig,
  103     pretrained: bool = True,
  104     checkpoints_path: Optional[Union[str, Path]] = "checkpoints",
  105     force_download=False,
  106     cfg_options=None,
  107 ):
  108 
  109     model_name = backbone.model_name
  110     config_path = backbone.config_path
  111     weights_url = backbone.weights_url
  112 
  113     # download weights
  114     weights_path = None
  115     if pretrained and weights_url:
  116         save_dir = Path(checkpoints_path) / model_name
  117         save_dir.mkdir(exist_ok=True, parents=True)
  118 
  119         fname = Path(weights_url).name
  120         weights_path = save_dir / fname
  121 
  122         if not weights_path.exists() or force_download:
  123             download_url(url=weights_url, save_path=str(weights_path))
  124 
  125     cfg = Config.fromfile(config_path)
  126 
  127     if cfg_options is not None:
  128         cfg.merge_from_dict(cfg_options)
  129 
  130     return cfg, weights_path
  131
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/icevision/models/mmdet/utils.py b/icevision/models/mmdet/utils.py
  --- a/icevision/models/mmdet/utils.py
  +++ b/icevision/models/mmdet/utils.py
  @@ -6,6 +6,7 @@
       "create_model_config",
   ]
   
  +from numpy import False_
   from icevision.imports import *
   from icevision.utils import *
   from icevision.backbones import BackboneConfig
  @@ -81,9 +82,9 @@
           layers += [model.bbox_head]
   
           # YOLACT has mask_head and segm_head
  -        if getattr(model, "mask_head"):
  +        if hasattr(model, "mask_head"):
               layers += [model.mask_head]
  -        if getattr(model, "segm_head"):
  +        if hasattr(model, "segm_head"):
               layers += [model.segm_head]
   
       elif isinstance(model, TwoStageDetector):
  
verification_info: {"golden_diff": "diff --git a/icevision/models/mmdet/utils.py b/icevision/models/mmdet/utils.py\n--- a/icevision/models/mmdet/utils.py\n+++ b/icevision/models/mmdet/utils.py\n@@ -6,6 +6,7 @@\n     \"create_model_config\",\n ]\n \n+from numpy import False_\n from icevision.imports import *\n from icevision.utils import *\n from icevision.backbones import BackboneConfig\n@@ -81,9 +82,9 @@\n         layers += [model.bbox_head]\n \n         # YOLACT has mask_head and segm_head\n-        if getattr(model, \"mask_head\"):\n+        if hasattr(model, \"mask_head\"):\n             layers += [model.mask_head]\n-        if getattr(model, \"segm_head\"):\n+        if hasattr(model, \"segm_head\"):\n             layers += [model.segm_head]\n \n     elif isinstance(model, TwoStageDetector):\n", "issue": "getting_started_object_detection.ipynb fails after CentripetalNet support merge\n## \ud83d\udc1b Bug\r\n**Describe the bug**\r\n`getting_started_object_detection.ipynb` fails to run with the following error.\r\n\r\n`AttributeError: 'VFNet' object has no attribute 'mask_head'\r\n`\r\n**To Reproduce**\r\nSteps to reproduce the behavior: Run the getting started notebook.\r\n\r\n**Expected behavior**\r\nModel should instantiate.\r\n\r\n**Screenshots**\r\n![image](https://user-images.githubusercontent.com/6821286/152749230-5ebaaaee-d21e-462d-858d-26b890c95067.png)\n", "before_files": [{"content": "__all__ = [\n    \"MMDetBackboneConfig\",\n    \"mmdet_configs_path\",\n    \"param_groups\",\n    \"MMDetBackboneConfig\",\n    \"create_model_config\",\n]\n\nfrom icevision.imports import *\nfrom icevision.utils import *\nfrom icevision.backbones import BackboneConfig\nfrom icevision.models.mmdet.download_configs import download_mmdet_configs\nfrom mmdet.models.detectors import *\nfrom mmcv import Config\nfrom mmdet.models.backbones.ssd_vgg import SSDVGG\nfrom mmdet.models.backbones.csp_darknet import CSPDarknet\nfrom mmdet.models.backbones.swin import SwinTransformer\nfrom mmdet.models.backbones.hourglass import HourglassNet\n\n\nmmdet_configs_path = download_mmdet_configs()\n\n\nclass MMDetBackboneConfig(BackboneConfig):\n    def __init__(self, model_name, config_path, weights_url):\n        self.model_name = model_name\n        self.config_path = config_path\n        self.weights_url = weights_url\n        self.pretrained: bool\n\n    def __call__(self, pretrained: bool = True) -> \"MMDetBackboneConfig\":\n        self.pretrained = pretrained\n        return self\n\n\ndef param_groups(model):\n    body = model.backbone\n\n    layers = []\n\n    # add the backbone\n    if isinstance(body, SSDVGG):\n        layers += [body.features]\n    elif isinstance(body, CSPDarknet):\n        layers += [body.stem.conv.conv, body.stem.conv.bn]\n        layers += [body.stage1, body.stage2, body.stage3, body.stage4]\n\n    elif isinstance(body, HourglassNet):\n        layers += [\n            body.stem,\n            body.hourglass_modules,\n            body.inters,\n            body.conv1x1s,\n            body.out_convs,\n            body.remap_convs,\n            body.relu,\n        ]\n\n    elif isinstance(body, SwinTransformer):\n        layers += [\n            body.patch_embed.adap_padding,\n            body.patch_embed.projection,\n            body.patch_embed.norm,\n            body.drop_after_pos,\n            body.stages,\n        ]\n        # Swin backbone for two-stage detector has norm0 attribute\n        if getattr(body, \"norm0\", False):\n            layers += [body.norm0]\n\n        layers += [body.norm1, body.norm2, body.norm3]\n    else:\n        layers += [nn.Sequential(body.conv1, body.bn1)]\n        layers += [getattr(body, l) for l in body.res_layers]\n\n    # add the neck module if it exists (DETR doesn't have a neck module)\n    layers += [module for name, module in model.named_modules() if name == \"neck\"]\n\n    # add the head\n    if isinstance(model, SingleStageDetector):\n        layers += [model.bbox_head]\n\n        # YOLACT has mask_head and segm_head\n        if getattr(model, \"mask_head\"):\n            layers += [model.mask_head]\n        if getattr(model, \"segm_head\"):\n            layers += [model.segm_head]\n\n    elif isinstance(model, TwoStageDetector):\n        layers += [nn.Sequential(model.rpn_head, model.roi_head)]\n    else:\n        raise RuntimeError(\n            \"{model} must inherit either from SingleStageDetector or TwoStageDetector class\"\n        )\n\n    _param_groups = [list(layer.parameters()) for layer in layers]\n    check_all_model_params_in_groups2(model, _param_groups)\n    return _param_groups\n\n\ndef create_model_config(\n    backbone: MMDetBackboneConfig,\n    pretrained: bool = True,\n    checkpoints_path: Optional[Union[str, Path]] = \"checkpoints\",\n    force_download=False,\n    cfg_options=None,\n):\n\n    model_name = backbone.model_name\n    config_path = backbone.config_path\n    weights_url = backbone.weights_url\n\n    # download weights\n    weights_path = None\n    if pretrained and weights_url:\n        save_dir = Path(checkpoints_path) / model_name\n        save_dir.mkdir(exist_ok=True, parents=True)\n\n        fname = Path(weights_url).name\n        weights_path = save_dir / fname\n\n        if not weights_path.exists() or force_download:\n            download_url(url=weights_url, save_path=str(weights_path))\n\n    cfg = Config.fromfile(config_path)\n\n    if cfg_options is not None:\n        cfg.merge_from_dict(cfg_options)\n\n    return cfg, weights_path\n", "path": "icevision/models/mmdet/utils.py"}], "after_files": [{"content": "__all__ = [\n    \"MMDetBackboneConfig\",\n    \"mmdet_configs_path\",\n    \"param_groups\",\n    \"MMDetBackboneConfig\",\n    \"create_model_config\",\n]\n\nfrom numpy import False_\nfrom icevision.imports import *\nfrom icevision.utils import *\nfrom icevision.backbones import BackboneConfig\nfrom icevision.models.mmdet.download_configs import download_mmdet_configs\nfrom mmdet.models.detectors import *\nfrom mmcv import Config\nfrom mmdet.models.backbones.ssd_vgg import SSDVGG\nfrom mmdet.models.backbones.csp_darknet import CSPDarknet\nfrom mmdet.models.backbones.swin import SwinTransformer\nfrom mmdet.models.backbones.hourglass import HourglassNet\n\n\nmmdet_configs_path = download_mmdet_configs()\n\n\nclass MMDetBackboneConfig(BackboneConfig):\n    def __init__(self, model_name, config_path, weights_url):\n        self.model_name = model_name\n        self.config_path = config_path\n        self.weights_url = weights_url\n        self.pretrained: bool\n\n    def __call__(self, pretrained: bool = True) -> \"MMDetBackboneConfig\":\n        self.pretrained = pretrained\n        return self\n\n\ndef param_groups(model):\n    body = model.backbone\n\n    layers = []\n\n    # add the backbone\n    if isinstance(body, SSDVGG):\n        layers += [body.features]\n    elif isinstance(body, CSPDarknet):\n        layers += [body.stem.conv.conv, body.stem.conv.bn]\n        layers += [body.stage1, body.stage2, body.stage3, body.stage4]\n\n    elif isinstance(body, HourglassNet):\n        layers += [\n            body.stem,\n            body.hourglass_modules,\n            body.inters,\n            body.conv1x1s,\n            body.out_convs,\n            body.remap_convs,\n            body.relu,\n        ]\n\n    elif isinstance(body, SwinTransformer):\n        layers += [\n            body.patch_embed.adap_padding,\n            body.patch_embed.projection,\n            body.patch_embed.norm,\n            body.drop_after_pos,\n            body.stages,\n        ]\n        # Swin backbone for two-stage detector has norm0 attribute\n        if getattr(body, \"norm0\", False):\n            layers += [body.norm0]\n\n        layers += [body.norm1, body.norm2, body.norm3]\n    else:\n        layers += [nn.Sequential(body.conv1, body.bn1)]\n        layers += [getattr(body, l) for l in body.res_layers]\n\n    # add the neck module if it exists (DETR doesn't have a neck module)\n    layers += [module for name, module in model.named_modules() if name == \"neck\"]\n\n    # add the head\n    if isinstance(model, SingleStageDetector):\n        layers += [model.bbox_head]\n\n        # YOLACT has mask_head and segm_head\n        if hasattr(model, \"mask_head\"):\n            layers += [model.mask_head]\n        if hasattr(model, \"segm_head\"):\n            layers += [model.segm_head]\n\n    elif isinstance(model, TwoStageDetector):\n        layers += [nn.Sequential(model.rpn_head, model.roi_head)]\n    else:\n        raise RuntimeError(\n            \"{model} must inherit either from SingleStageDetector or TwoStageDetector class\"\n        )\n\n    _param_groups = [list(layer.parameters()) for layer in layers]\n    check_all_model_params_in_groups2(model, _param_groups)\n    return _param_groups\n\n\ndef create_model_config(\n    backbone: MMDetBackboneConfig,\n    pretrained: bool = True,\n    checkpoints_path: Optional[Union[str, Path]] = \"checkpoints\",\n    force_download=False,\n    cfg_options=None,\n):\n\n    model_name = backbone.model_name\n    config_path = backbone.config_path\n    weights_url = backbone.weights_url\n\n    # download weights\n    weights_path = None\n    if pretrained and weights_url:\n        save_dir = Path(checkpoints_path) / model_name\n        save_dir.mkdir(exist_ok=True, parents=True)\n\n        fname = Path(weights_url).name\n        weights_path = save_dir / fname\n\n        if not weights_path.exists() or force_download:\n            download_url(url=weights_url, save_path=str(weights_path))\n\n    cfg = Config.fromfile(config_path)\n\n    if cfg_options is not None:\n        cfg.merge_from_dict(cfg_options)\n\n    return cfg, weights_path\n", "path": "icevision/models/mmdet/utils.py"}]}