Skip to content

Commit 2de9314

Browse files
amyerobertsArthurZucker
authored andcommitted
[Maskformer] safely get backbone config (#29166)
Safe getattr
1 parent 476957b commit 2de9314

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/transformers/models/maskformer/modeling_maskformer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ def __init__(self, config: MaskFormerConfig):
14391439
The configuration used to instantiate this model.
14401440
"""
14411441
super().__init__()
1442-
if hasattr(config, "backbone_config") and config.backbone_config.model_type == "swin":
1442+
if getattr(config, "backbone_config") is not None and config.backbone_config.model_type == "swin":
14431443
# for backwards compatibility
14441444
backbone_config = config.backbone_config
14451445
backbone_config = MaskFormerSwinConfig.from_dict(backbone_config.to_dict())

0 commit comments

Comments
 (0)