Skip to content

Commit 49b9c3b

Browse files
committed
Include pretrained tag in deprecated mapping warning
1 parent 0d5c5c3 commit 49b9c3b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

timm/models/_registry.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ def register_model(fn: Callable[..., Any]) -> Callable[..., Any]:
133133
def _deprecated_model_shim(deprecated_name: str, current_fn: Callable = None, current_tag: str = ''):
134134
def _fn(pretrained=False, **kwargs):
135135
assert current_fn is not None, f'Model {deprecated_name} has been removed with no replacement.'
136-
warnings.warn(f'Mapping deprecated model {deprecated_name} to current {current_fn.__name__}', stacklevel=2)
136+
current_name = '.'.join([current_fn.__name__, current_tag]) if current_tag else current_fn.__name__
137+
warnings.warn(f'Mapping deprecated model {deprecated_name} to current {current_name}.', stacklevel=2)
137138
pretrained_cfg = kwargs.pop('pretrained_cfg', None)
138139
return current_fn(pretrained=pretrained, pretrained_cfg=pretrained_cfg or current_tag, **kwargs)
139140
return _fn

0 commit comments

Comments
 (0)