Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
58245ba6
Unverified
Commit
58245ba6
authored
Feb 21, 2024
by
amyeroberts
Committed by
GitHub
Feb 21, 2024
Browse files
[`Maskformer`] safely get backbone config (#29166)
Safe getattr
parent
1d0ea7ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/models/maskformer/modeling_maskformer.py
src/transformers/models/maskformer/modeling_maskformer.py
+1
-1
No files found.
src/transformers/models/maskformer/modeling_maskformer.py
View file @
58245ba6
...
...
@@ -1439,7 +1439,7 @@ class MaskFormerPixelLevelModule(nn.Module):
The configuration used to instantiate this model.
"""
super
().
__init__
()
if
has
attr
(
config
,
"backbone_config"
)
and
config
.
backbone_config
.
model_type
==
"swin"
:
if
get
attr
(
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
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment