"fs/vscode:/vscode.git/clone" did not exist on "b1c40138dadfd32550ae03391bdee63ef5e2b8bb"
Unverified Commit 58245ba6 authored by amyeroberts's avatar amyeroberts Committed by GitHub
Browse files

[`Maskformer`] safely get backbone config (#29166)

Safe getattr
parent 1d0ea7ab
......@@ -1439,7 +1439,7 @@ class MaskFormerPixelLevelModule(nn.Module):
The configuration used to instantiate this model.
"""
super().__init__()
if hasattr(config, "backbone_config") and config.backbone_config.model_type == "swin":
if getattr(config, "backbone_config") is not None and config.backbone_config.model_type == "swin":
# for backwards compatibility
backbone_config = config.backbone_config
backbone_config = MaskFormerSwinConfig.from_dict(backbone_config.to_dict())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment