diff --git a/timm/models/_hub.py b/timm/models/_hub.py index 00d3d750da..e4c603ff8c 100644 --- a/timm/models/_hub.py +++ b/timm/models/_hub.py @@ -30,8 +30,8 @@ from timm.models._pretrained import filter_pretrained_cfg try: - from huggingface_hub import HfApi, hf_hub_download - from huggingface_hub.utils import EntryNotFoundError + from huggingface_hub import HfApi, hf_hub_download, model_info + from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError hf_hub_download = partial(hf_hub_download, library_name="timm", library_version=__version__) _has_hf_hub = True except ImportError: @@ -533,3 +533,56 @@ def _get_safe_alternatives(filename: str) -> Iterable[str]: yield HF_OPEN_CLIP_SAFE_WEIGHTS_NAME if filename not in (HF_WEIGHTS_NAME, HF_OPEN_CLIP_WEIGHTS_NAME) and filename.endswith(".bin"): yield filename[:-4] + ".safetensors" + + +def _get_license_from_hf_hub(model_id: str | None, hf_hub_id: str | None) -> str | None: + """Retrieve license information for a model from Hugging Face Hub. + + Fetches the license field from the model card metadata on Hugging Face Hub + for the specified model. Returns None if the model is not found, if + huggingface_hub is not installed, or if the model is marked as "untrained". + + Args: + model_id: The model identifier/name. In the case of None we assume an untrained model. + hf_hub_id: The Hugging Face Hub organization/user ID. If it is None, + we will return None as we cannot infer the license terms. + + Returns: + The license string in lowercase if found, None otherwise. + + Note: + Requires huggingface_hub package to be installed. Will log a warning + and return None if the package is not available. + """ + if not has_hf_hub(True): + msg = "For updated license information run `pip install huggingface_hub`." + _logger.warning(msg=msg) + return None + + if not (model_id and hf_hub_id): + return None + + repo_id: str = hf_hub_id + model_id + + try: + info = model_info(repo_id=repo_id) + + except RepositoryNotFoundError: + msg = f"Repository {repo_id} was not found. Manual inspection of license needed." + _logger.warning(msg=msg) + return None + + except Exception as _: + msg = f"Error for {repo_id}. Manual inspection of license needed." + _logger.warning(msg=msg) + return None + + license = info.card_data.get("license").lower() if info.card_data else None + + if license == 'other': + name = info.card_data.get("license_name", None) + + if name is not None: + return name + + return license diff --git a/timm/models/beit.py b/timm/models/beit.py index 6c241edf35..baf4d11725 100644 --- a/timm/models/beit.py +++ b/timm/models/beit.py @@ -773,6 +773,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0.5), 'first_conv': 'patch_embed.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/byoanet.py b/timm/models/byoanet.py index f5af4fd113..3f79211534 100644 --- a/timm/models/byoanet.py +++ b/timm/models/byoanet.py @@ -297,7 +297,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 0.95, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv1.conv', 'classifier': 'head.fc', - 'fixed_input_size': False, 'min_input_size': (3, 224, 224), + 'fixed_input_size': False, 'min_input_size': (3, 224, 224), 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/byobnet.py b/timm/models/byobnet.py index 60a443d3d8..0e33aabcfd 100644 --- a/timm/models/byobnet.py +++ b/timm/models/byobnet.py @@ -2432,6 +2432,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } @@ -2451,6 +2452,7 @@ def _cfgr(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 0.9, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv1.conv', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } @@ -2604,26 +2606,31 @@ def _cfgr(url: str = '', **kwargs) -> Dict[str, Any]: hf_hub_id='timm/', crop_pct=0.875, first_conv=('stem.conv_kxk.0.conv', 'stem.conv_scale.conv'), + license='mobileone-license', ), 'mobileone_s1.apple_in1k': _cfg( hf_hub_id='timm/', crop_pct=0.9, first_conv=('stem.conv_kxk.0.conv', 'stem.conv_scale.conv'), + license='mobileone-license', ), 'mobileone_s2.apple_in1k': _cfg( hf_hub_id='timm/', crop_pct=0.9, first_conv=('stem.conv_kxk.0.conv', 'stem.conv_scale.conv'), + license='mobileone-license', ), 'mobileone_s3.apple_in1k': _cfg( hf_hub_id='timm/', crop_pct=0.9, first_conv=('stem.conv_kxk.0.conv', 'stem.conv_scale.conv'), + license='mobileone-license', ), 'mobileone_s4.apple_in1k': _cfg( hf_hub_id='timm/', crop_pct=0.9, first_conv=('stem.conv_kxk.0.conv', 'stem.conv_scale.conv'), + license='mobileone-license', ), # original attention pool head variants @@ -2632,48 +2639,56 @@ def _cfgr(url: str = '', **kwargs) -> Dict[str, Any]: num_classes=1024, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 224, 224), pool_size=(7, 7), classifier='head.proj', + license='mit', ), 'resnet101_clip.openai': _cfgr( hf_hub_id='timm/', num_classes=512, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 224, 224), pool_size=(7, 7), classifier='head.proj', + license='mit', ), 'resnet50x4_clip.openai': _cfgr( hf_hub_id='timm/', num_classes=640, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 288, 288), pool_size=(9, 9), classifier='head.proj', + license='mit', ), 'resnet50x16_clip.openai': _cfgr( hf_hub_id='timm/', num_classes=768, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 384, 384), pool_size=(12, 12), classifier='head.proj', + license='mit', ), 'resnet50x64_clip.openai': _cfgr( hf_hub_id='timm/', num_classes=1024, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 448, 448), pool_size=(14, 14), classifier='head.proj', + license='mit', ), 'resnet50_clip.cc12m': _cfgr( hf_hub_id='timm/', num_classes=1024, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 224, 224), pool_size=(7, 7), classifier='head.proj', + license='mit', ), 'resnet50_clip.yfcc15m': _cfgr( hf_hub_id='timm/', num_classes=1024, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 224, 224), pool_size=(7, 7), classifier='head.proj', + license='mit', ), 'resnet101_clip.yfcc15m': _cfgr( hf_hub_id='timm/', num_classes=512, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, fixed_input_size=True, input_size=(3, 224, 224), pool_size=(7, 7), classifier='head.proj', + license='mit', ), # avg-pool w/ optional standard classifier head variants @@ -2681,41 +2696,49 @@ def _cfgr(url: str = '', **kwargs) -> Dict[str, Any]: hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 224, 224), pool_size=(7, 7), + license='mit', ), 'resnet101_clip_gap.openai': _cfgr( hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 224, 224), pool_size=(7, 7), + license='mit', ), 'resnet50x4_clip_gap.openai': _cfgr( hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 288, 288), pool_size=(9, 9), + license='mit', ), 'resnet50x16_clip_gap.openai': _cfgr( hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 384, 384), pool_size=(12, 12), + license='mit', ), 'resnet50x64_clip_gap.openai': _cfgr( hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 448, 448), pool_size=(14, 14), + license='mit', ), 'resnet50_clip_gap.cc12m': _cfgr( hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 224, 224), pool_size=(7, 7), + license='mit', ), 'resnet50_clip_gap.yfcc15m': _cfgr( hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 224, 224), pool_size=(7, 7), + license='mit', ), 'resnet101_clip_gap.yfcc15m': _cfgr( hf_hub_id='timm/', num_classes=0, mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 224, 224), pool_size=(7, 7), + license='mit', ), 'resnet50_mlp.untrained': _cfgr( diff --git a/timm/models/cait.py b/timm/models/cait.py index b484ef4d8c..315ab98931 100644 --- a/timm/models/cait.py +++ b/timm/models/cait.py @@ -508,6 +508,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 1.0, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/coat.py b/timm/models/coat.py index 770cf18fb7..f239c31ea7 100644 --- a/timm/models/coat.py +++ b/timm/models/coat.py @@ -759,6 +759,7 @@ def _cfg_coat(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed1.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } @@ -839,4 +840,4 @@ def coat_lite_medium_384(pretrained=False, **kwargs) -> CoaT: model_cfg = dict( img_size=384, patch_size=4, embed_dims=[128, 256, 320, 512], serial_depths=[3, 6, 10, 8]) model = _create_coat('coat_lite_medium_384', pretrained=pretrained, **dict(model_cfg, **kwargs)) - return model \ No newline at end of file + return model diff --git a/timm/models/convit.py b/timm/models/convit.py index ece9ad0895..272649c656 100644 --- a/timm/models/convit.py +++ b/timm/models/convit.py @@ -420,7 +420,7 @@ def _cfg(url='', **kwargs): 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': None, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'fixed_input_size': True, - 'first_conv': 'patch_embed.proj', 'classifier': 'head', + 'first_conv': 'patch_embed.proj', 'classifier': 'head', 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/convmixer.py b/timm/models/convmixer.py index 55978f67f8..bad04bd154 100644 --- a/timm/models/convmixer.py +++ b/timm/models/convmixer.py @@ -118,7 +118,7 @@ def _cfg(url='', **kwargs): 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': None, 'crop_pct': .96, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'classifier': 'head', - 'first_conv': 'stem.0', + 'first_conv': 'stem.0', 'license': 'mit', **kwargs } @@ -146,4 +146,4 @@ def convmixer_768_32(pretrained=False, **kwargs) -> ConvMixer: @register_model def convmixer_1024_20_ks9_p14(pretrained=False, **kwargs) -> ConvMixer: model_args = dict(dim=1024, depth=20, kernel_size=9, patch_size=14, **kwargs) - return _create_convmixer('convmixer_1024_20_ks9_p14', pretrained, **model_args) \ No newline at end of file + return _create_convmixer('convmixer_1024_20_ks9_p14', pretrained, **model_args) diff --git a/timm/models/convnext.py b/timm/models/convnext.py index c801f7c887..93d8ce769b 100644 --- a/timm/models/convnext.py +++ b/timm/models/convnext.py @@ -711,7 +711,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.0', 'classifier': 'head.fc', - **kwargs + 'license': 'apache-2.0', **kwargs } @@ -1113,25 +1113,25 @@ def _cfgv2(url='', **kwargs): hf_hub_id='timm/', crop_pct=1.0, num_classes=0, - license='dinov3', + license='dinov3-license', ), 'convnext_small.dinov3_lvd1689m': _cfg( hf_hub_id='timm/', crop_pct=1.0, num_classes=0, - license='dinov3', + license='dinov3-license', ), 'convnext_base.dinov3_lvd1689m': _cfg( hf_hub_id='timm/', crop_pct=1.0, num_classes=0, - license='dinov3', + license='dinov3-license', ), 'convnext_large.dinov3_lvd1689m': _cfg( hf_hub_id='timm/', crop_pct=1.0, num_classes=0, - license='dinov3', + license='dinov3-license', ), "test_convnext.r160_in1k": _cfg( diff --git a/timm/models/crossvit.py b/timm/models/crossvit.py index a19489b358..a0cb5c4d20 100644 --- a/timm/models/crossvit.py +++ b/timm/models/crossvit.py @@ -519,6 +519,7 @@ def _cfg(url='', **kwargs): 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'fixed_input_size': True, 'first_conv': ('patch_embed.0.proj', 'patch_embed.1.proj'), 'classifier': ('head.0', 'head.1'), + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/cspnet.py b/timm/models/cspnet.py index 6de3b354ee..5cf7fff03d 100644 --- a/timm/models/cspnet.py +++ b/timm/models/cspnet.py @@ -1010,7 +1010,7 @@ def _cfg(url='', **kwargs): 'num_classes': 1000, 'input_size': (3, 256, 256), 'pool_size': (8, 8), 'crop_pct': 0.887, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, - 'first_conv': 'stem.conv1.conv', 'classifier': 'head.fc', + 'first_conv': 'stem.conv1.conv', 'classifier': 'head.fc', 'license': 'apache-2.0', **kwargs } @@ -1204,4 +1204,4 @@ def cs3edgenet_x(pretrained=False, **kwargs) -> CspNet: @register_model def cs3se_edgenet_x(pretrained=False, **kwargs) -> CspNet: - return _create_cspnet('cs3se_edgenet_x', pretrained=pretrained, **kwargs) \ No newline at end of file + return _create_cspnet('cs3se_edgenet_x', pretrained=pretrained, **kwargs) diff --git a/timm/models/davit.py b/timm/models/davit.py index f030a43a07..4608b2365d 100644 --- a/timm/models/davit.py +++ b/timm/models/davit.py @@ -870,6 +870,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.95, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/deit.py b/timm/models/deit.py index ed8a6dec1d..237c59546c 100644 --- a/timm/models/deit.py +++ b/timm/models/deit.py @@ -141,6 +141,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/densenet.py b/timm/models/densenet.py index a09da46d23..b87b6a1f74 100644 --- a/timm/models/densenet.py +++ b/timm/models/densenet.py @@ -488,7 +488,8 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, - 'first_conv': 'features.conv0', 'classifier': 'classifier', **kwargs, + 'first_conv': 'features.conv0', 'classifier': 'classifier', 'license': 'apache-2.0', + **kwargs, } diff --git a/timm/models/dla.py b/timm/models/dla.py index 2763686dbf..0cc15fae15 100644 --- a/timm/models/dla.py +++ b/timm/models/dla.py @@ -492,7 +492,7 @@ def _cfg(url='', **kwargs): 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, - 'first_conv': 'base_layer.0', 'classifier': 'fc', + 'first_conv': 'base_layer.0', 'classifier': 'fc', 'license': 'bsd-3-clause', **kwargs } @@ -508,8 +508,8 @@ def _cfg(url='', **kwargs): 'dla102x.in1k': _cfg(hf_hub_id='timm/'), 'dla102x2.in1k': _cfg(hf_hub_id='timm/'), 'dla169.in1k': _cfg(hf_hub_id='timm/'), - 'dla60_res2net.in1k': _cfg(hf_hub_id='timm/'), - 'dla60_res2next.in1k': _cfg(hf_hub_id='timm/'), + 'dla60_res2net.in1k': _cfg(hf_hub_id='timm/', license='unknown'), + 'dla60_res2next.in1k': _cfg(hf_hub_id='timm/', license='unknown'), }) diff --git a/timm/models/dpn.py b/timm/models/dpn.py index 759658b75d..9e64f113a3 100644 --- a/timm/models/dpn.py +++ b/timm/models/dpn.py @@ -330,7 +330,7 @@ def _cfg(url='', **kwargs): 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DPN_MEAN, 'std': IMAGENET_DPN_STD, - 'first_conv': 'features.conv1_1.conv', 'classifier': 'classifier', + 'first_conv': 'features.conv1_1.conv', 'classifier': 'classifier', 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/edgenext.py b/timm/models/edgenext.py index a83ea6ddf4..bc4e6724c0 100644 --- a/timm/models/edgenext.py +++ b/timm/models/edgenext.py @@ -621,6 +621,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.9, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.0', 'classifier': 'head.fc', + 'license': 'mit', **kwargs } diff --git a/timm/models/efficientformer.py b/timm/models/efficientformer.py index 7e140da581..622592e4da 100644 --- a/timm/models/efficientformer.py +++ b/timm/models/efficientformer.py @@ -625,6 +625,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .95, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv1', 'classifier': ('head', 'head_dist'), + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/efficientformer_v2.py b/timm/models/efficientformer_v2.py index 92fbdaf14a..4e621d95df 100644 --- a/timm/models/efficientformer_v2.py +++ b/timm/models/efficientformer_v2.py @@ -806,6 +806,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .95, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'classifier': ('head', 'head_dist'), 'first_conv': 'stem.conv1.conv', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/efficientnet.py b/timm/models/efficientnet.py index edc568335e..e48e284fbe 100644 --- a/timm/models/efficientnet.py +++ b/timm/models/efficientnet.py @@ -1324,7 +1324,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv_stem', 'classifier': 'classifier', - **kwargs + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/efficientvit_mit.py b/timm/models/efficientvit_mit.py index 3cae78d897..05a9f50970 100644 --- a/timm/models/efficientvit_mit.py +++ b/timm/models/efficientvit_mit.py @@ -1083,6 +1083,7 @@ def _cfg(url='', **kwargs): 'first_conv': 'stem.in_conv.conv', 'classifier': 'head.classifier.4', 'crop_pct': 0.95, + 'license': 'apache-2.0', 'input_size': (3, 224, 224), 'pool_size': (7, 7), **kwargs, diff --git a/timm/models/efficientvit_msra.py b/timm/models/efficientvit_msra.py index 497e984726..a445d680fd 100644 --- a/timm/models/efficientvit_msra.py +++ b/timm/models/efficientvit_msra.py @@ -672,6 +672,7 @@ def _cfg(url='', **kwargs): 'classifier': 'head.linear', 'fixed_input_size': True, 'pool_size': (4, 4), + 'license': 'mit', **kwargs, } diff --git a/timm/models/eva.py b/timm/models/eva.py index 117a76b5c1..761fee7644 100644 --- a/timm/models/eva.py +++ b/timm/models/eva.py @@ -1285,7 +1285,7 @@ def _pe_cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 1.0, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0.5), 'first_conv': 'patch_embed.proj', 'classifier': 'head', - 'license': 'custom', **kwargs + 'license': 'apache-2.0', **kwargs } @@ -1305,7 +1305,7 @@ def _dinov3_cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 1.0, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head', - 'license': 'dinov3', **kwargs + 'license': 'dinov3-license', **kwargs } default_cfgs = generate_default_cfgs({ @@ -2567,7 +2567,7 @@ def vit_large_patch16_rope_ape_224(pretrained: bool = False, **kwargs) -> Eva: rope_grid_indexing='xy', rope_temperature=100.0, ) - + model = _create_eva('vit_large_patch16_rope_ape_224', pretrained=pretrained, **dict(model_args, **kwargs)) return model diff --git a/timm/models/fasternet.py b/timm/models/fasternet.py index f956f70ac4..0d3e117219 100644 --- a/timm/models/fasternet.py +++ b/timm/models/fasternet.py @@ -426,6 +426,7 @@ def _cfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'paper_ids': 'arXiv:2303.03667', 'paper_name': "Run, Don't Walk: Chasing Higher FLOPS for Faster Neural Networks", 'origin_url': 'https://github.com/JierunChen/FasterNet', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/fastvit.py b/timm/models/fastvit.py index bef5ec8b61..61dbd04c49 100644 --- a/timm/models/fastvit.py +++ b/timm/models/fastvit.py @@ -1431,6 +1431,7 @@ def _cfg(url="", **kwargs): "crop_pct": 0.9, "interpolation": "bicubic", "mean": IMAGENET_DEFAULT_MEAN, + "license": "fastvit-license", "std": IMAGENET_DEFAULT_STD, 'first_conv': ('stem.0.conv_kxk.0.conv', 'stem.0.conv_scale.conv'), "classifier": "head.fc", @@ -1481,21 +1482,21 @@ def _cfg(url="", **kwargs): url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_s0.pt', crop_pct=0.95, num_classes=512, # CLIP proj dim - mean=(0., 0., 0.), std=(1., 1., 1.) + mean=(0., 0., 0.), std=(1., 1., 1.), license='apple-amlr' ), "fastvit_mci1.apple_mclip": _cfg( hf_hub_id='apple/mobileclip_s1_timm', url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_s1.pt', crop_pct=0.95, num_classes=512, # CLIP proj dim - mean=(0., 0., 0.), std=(1., 1., 1.) + mean=(0., 0., 0.), std=(1., 1., 1.), license='apple-amlr' ), "fastvit_mci2.apple_mclip": _cfg( hf_hub_id='apple/mobileclip_s2_timm', url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_s2.pt', crop_pct=0.95, num_classes=512, # CLIP proj dim - mean=(0., 0., 0.), std=(1., 1., 1.) + mean=(0., 0., 0.), std=(1., 1., 1.), license='apple-amlr' ), "fastvit_mci0.apple_mclip2_dfndr2b": _cfg( @@ -1803,4 +1804,4 @@ def fastvit_mci4(pretrained=False, **kwargs): ) model = _create_fastvit('fastvit_mci4', pretrained=pretrained, **dict(model_args, **kwargs)) - return model \ No newline at end of file + return model diff --git a/timm/models/gcvit.py b/timm/models/gcvit.py index 2533ed949c..1fadffec0d 100644 --- a/timm/models/gcvit.py +++ b/timm/models/gcvit.py @@ -615,6 +615,7 @@ def _cfg(url='', **kwargs): 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv1', 'classifier': 'head.fc', 'fixed_input_size': True, + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/ghostnet.py b/timm/models/ghostnet.py index 53d988ac96..eb2e9d5806 100644 --- a/timm/models/ghostnet.py +++ b/timm/models/ghostnet.py @@ -911,6 +911,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv_stem', 'classifier': 'classifier', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/hardcorenas.py b/timm/models/hardcorenas.py index 459c1a3db8..491f7c0367 100644 --- a/timm/models/hardcorenas.py +++ b/timm/models/hardcorenas.py @@ -58,6 +58,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv_stem', 'classifier': 'classifier', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/hgnet.py b/timm/models/hgnet.py index 927b2c4dc6..dadda65340 100644 --- a/timm/models/hgnet.py +++ b/timm/models/hgnet.py @@ -749,6 +749,7 @@ def _cfg(url='', **kwargs): 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'classifier': 'head.fc', 'first_conv': 'stem.stem1.conv', 'test_crop_pct': 1.0, 'test_input_size': (3, 288, 288), + 'license': 'apache-2.0', **kwargs, } diff --git a/timm/models/hiera.py b/timm/models/hiera.py index 81342a2fef..b078719e10 100644 --- a/timm/models/hiera.py +++ b/timm/models/hiera.py @@ -844,6 +844,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/hieradet_sam2.py b/timm/models/hieradet_sam2.py index 33bdcbf994..269aafb2fc 100644 --- a/timm/models/hieradet_sam2.py +++ b/timm/models/hieradet_sam2.py @@ -567,6 +567,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 1.0, 'interpolation': 'bicubic', 'min_input_size': (3, 224, 224), 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/hrnet.py b/timm/models/hrnet.py index 0a7734cd94..89cc2eeaec 100644 --- a/timm/models/hrnet.py +++ b/timm/models/hrnet.py @@ -928,14 +928,15 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv1', 'classifier': 'classifier', + 'license': 'mit', **kwargs } default_cfgs = generate_default_cfgs({ - 'hrnet_w18_small.gluon_in1k': _cfg(hf_hub_id='timm/', interpolation='bicubic'), + 'hrnet_w18_small.gluon_in1k': _cfg(hf_hub_id='timm/', interpolation='bicubic', license='apache-2.0'), 'hrnet_w18_small.ms_in1k': _cfg(hf_hub_id='timm/'), - 'hrnet_w18_small_v2.gluon_in1k': _cfg(hf_hub_id='timm/', interpolation='bicubic'), + 'hrnet_w18_small_v2.gluon_in1k': _cfg(hf_hub_id='timm/', interpolation='bicubic', license='apache-2.0'), 'hrnet_w18_small_v2.ms_in1k': _cfg(hf_hub_id='timm/'), 'hrnet_w18.ms_aug_in1k': _cfg( hf_hub_id='timm/', diff --git a/timm/models/inception_next.py b/timm/models/inception_next.py index a2a2097458..418cd79a9f 100644 --- a/timm/models/inception_next.py +++ b/timm/models/inception_next.py @@ -445,6 +445,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.0', 'classifier': 'head.fc2', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/inception_resnet_v2.py b/timm/models/inception_resnet_v2.py index 0e27efebeb..9e56315329 100644 --- a/timm/models/inception_resnet_v2.py +++ b/timm/models/inception_resnet_v2.py @@ -366,6 +366,7 @@ def _create_inception_resnet_v2(variant, pretrained=False, **kwargs): 'crop_pct': 0.8975, 'interpolation': 'bicubic', 'mean': IMAGENET_INCEPTION_MEAN, 'std': IMAGENET_INCEPTION_STD, 'first_conv': 'conv2d_1a.conv', 'classifier': 'classif', + 'license': 'apache-2.0', }, # As per https://arxiv.org/abs/1705.07204 and # ported from http://download.tensorflow.org/models/ens_adv_inception_resnet_v2_2017_08_18.tar.gz @@ -375,6 +376,7 @@ def _create_inception_resnet_v2(variant, pretrained=False, **kwargs): 'crop_pct': 0.8975, 'interpolation': 'bicubic', 'mean': IMAGENET_INCEPTION_MEAN, 'std': IMAGENET_INCEPTION_STD, 'first_conv': 'conv2d_1a.conv', 'classifier': 'classif', + 'license': 'apache-2.0', } }) diff --git a/timm/models/inception_v3.py b/timm/models/inception_v3.py index fd073c72fd..648153b259 100644 --- a/timm/models/inception_v3.py +++ b/timm/models/inception_v3.py @@ -468,7 +468,7 @@ def _cfg(url='', **kwargs): 'num_classes': 1000, 'input_size': (3, 299, 299), 'pool_size': (8, 8), 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_INCEPTION_MEAN, 'std': IMAGENET_INCEPTION_STD, - 'first_conv': 'Conv2d_1a_3x3.conv', 'classifier': 'fc', + 'first_conv': 'Conv2d_1a_3x3.conv', 'classifier': 'fc', 'license': 'apache-2.0', **kwargs } @@ -504,4 +504,4 @@ def inception_v3(pretrained=False, **kwargs) -> InceptionV3: 'tf_inception_v3': 'inception_v3.tf_in1k', 'adv_inception_v3': 'inception_v3.tf_adv_in1k', 'gluon_inception_v3': 'inception_v3.gluon_in1k', -}) \ No newline at end of file +}) diff --git a/timm/models/inception_v4.py b/timm/models/inception_v4.py index 9c06e1620a..150c51b474 100644 --- a/timm/models/inception_v4.py +++ b/timm/models/inception_v4.py @@ -434,6 +434,7 @@ def _create_inception_v4(variant, pretrained=False, **kwargs) -> InceptionV4: 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_INCEPTION_MEAN, 'std': IMAGENET_INCEPTION_STD, 'first_conv': 'features.0.conv', 'classifier': 'last_linear', + 'license': 'apache-2.0', } }) diff --git a/timm/models/levit.py b/timm/models/levit.py index affb48db8d..1463db4a68 100644 --- a/timm/models/levit.py +++ b/timm/models/levit.py @@ -931,6 +931,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv1.linear', 'classifier': ('head.linear', 'head_dist.linear'), + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/mambaout.py b/timm/models/mambaout.py index 991781ad4b..97c821c3e2 100644 --- a/timm/models/mambaout.py +++ b/timm/models/mambaout.py @@ -557,6 +557,7 @@ def _cfg(url='', **kwargs): 'pool_size': (7, 7), 'crop_pct': 1.0, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv1', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/maxxvit.py b/timm/models/maxxvit.py index 7cd332f925..c6d2517537 100644 --- a/timm/models/maxxvit.py +++ b/timm/models/maxxvit.py @@ -2151,7 +2151,7 @@ def _cfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0.5), 'first_conv': 'stem.conv1', 'classifier': 'head.fc', 'fixed_input_size': True, - **kwargs + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/metaformer.py b/timm/models/metaformer.py index a157124694..c8e18d752f 100644 --- a/timm/models/metaformer.py +++ b/timm/models/metaformer.py @@ -801,6 +801,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 1.0, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'classifier': 'head.fc', 'first_conv': 'stem.conv', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/mlp_mixer.py b/timm/models/mlp_mixer.py index a6db3dd7bc..ed3120b978 100644 --- a/timm/models/mlp_mixer.py +++ b/timm/models/mlp_mixer.py @@ -592,6 +592,7 @@ def _cfg(url='', **kwargs) -> Dict[str, Any]: 'crop_pct': 0.875, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0.5), 'first_conv': 'stem.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/mobilenetv3.py b/timm/models/mobilenetv3.py index 031cdbcf31..bfea64f127 100644 --- a/timm/models/mobilenetv3.py +++ b/timm/models/mobilenetv3.py @@ -1054,7 +1054,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv_stem', 'classifier': 'classifier', - **kwargs + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/mobilenetv5.py b/timm/models/mobilenetv5.py index f22dc76a3b..d1b2a52e21 100644 --- a/timm/models/mobilenetv5.py +++ b/timm/models/mobilenetv5.py @@ -842,7 +842,8 @@ def _cfg(url: str = '', **kwargs): hf_hub_id='timm/', mean=(0., 0., 0.), std=(1., 1., 1.), input_size=(3, 768, 768), - num_classes=0), + num_classes=0, + license='gemma'), # WIP classification configs for testing 'mobilenetv5_base.untrained': _cfg( diff --git a/timm/models/mobilevit.py b/timm/models/mobilevit.py index 93c9d4e306..2e68b4df2c 100644 --- a/timm/models/mobilevit.py +++ b/timm/models/mobilevit.py @@ -595,6 +595,7 @@ def _cfg(url='', **kwargs): 'mean': (0., 0., 0.), 'std': (1., 1., 1.), 'first_conv': 'stem.conv', 'classifier': 'head.fc', 'fixed_input_size': False, + 'license': 'cvnets-license', **kwargs } @@ -706,4 +707,4 @@ def mobilevitv2_200(pretrained=False, **kwargs) -> ByobNet: 'mobilevitv2_150_384_in22ft1k': 'mobilevitv2_150.cvnets_in22k_ft_in1k_384', 'mobilevitv2_175_384_in22ft1k': 'mobilevitv2_175.cvnets_in22k_ft_in1k_384', 'mobilevitv2_200_384_in22ft1k': 'mobilevitv2_200.cvnets_in22k_ft_in1k_384', -}) \ No newline at end of file +}) diff --git a/timm/models/mvitv2.py b/timm/models/mvitv2.py index 6b46e55970..45d8b9231f 100644 --- a/timm/models/mvitv2.py +++ b/timm/models/mvitv2.py @@ -1083,6 +1083,7 @@ def _cfg(url='', **kwargs): 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head.fc', 'fixed_input_size': True, + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/nasnet.py b/timm/models/nasnet.py index af17f44af4..c3b8d97ef5 100644 --- a/timm/models/nasnet.py +++ b/timm/models/nasnet.py @@ -705,6 +705,7 @@ def _create_nasnet(variant, pretrained=False, **kwargs): 'num_classes': 1000, 'first_conv': 'conv0.conv', 'classifier': 'last_linear', + 'license': 'apache-2.0', }, }) diff --git a/timm/models/nest.py b/timm/models/nest.py index 62aab6f023..41f9ebcc17 100644 --- a/timm/models/nest.py +++ b/timm/models/nest.py @@ -616,6 +616,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .875, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/nextvit.py b/timm/models/nextvit.py index fbaf4e515a..e7cbdca342 100644 --- a/timm/models/nextvit.py +++ b/timm/models/nextvit.py @@ -744,6 +744,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.95, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.0.conv', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/nfnet.py b/timm/models/nfnet.py index 16974d9fb3..e496a03515 100644 --- a/timm/models/nfnet.py +++ b/timm/models/nfnet.py @@ -839,7 +839,7 @@ def _dcfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.9, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, - 'first_conv': 'stem.conv1', 'classifier': 'head.fc', + 'first_conv': 'stem.conv1', 'classifier': 'head.fc', 'license': 'apache-2.0', **kwargs } @@ -1185,4 +1185,4 @@ def nf_ecaresnet101(pretrained: bool = False, **kwargs: Any) -> NormFreeNet: @register_model def test_nfnet(pretrained: bool = False, **kwargs: Any) -> NormFreeNet: """Test NFNet model for experimentation.""" - return _create_normfreenet('test_nfnet', pretrained=pretrained, **kwargs) \ No newline at end of file + return _create_normfreenet('test_nfnet', pretrained=pretrained, **kwargs) diff --git a/timm/models/pit.py b/timm/models/pit.py index dca27f598f..8d3743d13b 100644 --- a/timm/models/pit.py +++ b/timm/models/pit.py @@ -420,6 +420,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.conv', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/pnasnet.py b/timm/models/pnasnet.py index f8a16bd9e5..4d8cdd4e69 100644 --- a/timm/models/pnasnet.py +++ b/timm/models/pnasnet.py @@ -448,6 +448,7 @@ def _create_pnasnet(variant, pretrained=False, **kwargs): 'num_classes': 1000, 'first_conv': 'conv_0.conv', 'classifier': 'last_linear', + 'license': 'apache-2.0', }, }) diff --git a/timm/models/pvt_v2.py b/timm/models/pvt_v2.py index 1a00700022..95edfbcc02 100644 --- a/timm/models/pvt_v2.py +++ b/timm/models/pvt_v2.py @@ -532,6 +532,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.9, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head', 'fixed_input_size': False, + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/rdnet.py b/timm/models/rdnet.py index 2f86d93dcc..6c3e9ab536 100644 --- a/timm/models/rdnet.py +++ b/timm/models/rdnet.py @@ -480,6 +480,7 @@ def _cfg(url='', **kwargs): "paper_ids": "arXiv:2403.19588", "paper_name": "DenseNets Reloaded: Paradigm Shift Beyond ResNets and ViTs", "origin_url": "https://github.com/naver-ai/rdnet", + "license": "apache-2.0", **kwargs, } diff --git a/timm/models/regnet.py b/timm/models/regnet.py index b062eb2c2c..9b79d8fc80 100644 --- a/timm/models/regnet.py +++ b/timm/models/regnet.py @@ -1033,7 +1033,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'test_input_size': (3, 288, 288), 'crop_pct': 0.95, 'test_crop_pct': 1.0, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv', 'classifier': 'head.fc', - **kwargs + 'license': 'apache-2.0', **kwargs } @@ -1195,37 +1195,37 @@ def _cfgtv2(url: str = '', **kwargs) -> Dict[str, Any]: 'regnety_320.seer_ft_in1k': _cfgtv2( hf_hub_id='timm/', - license='other', origin_url='https://github.com/facebookresearch/vissl', + license='seer-license', origin_url='https://github.com/facebookresearch/vissl', url='https://dl.fbaipublicfiles.com/vissl/model_zoo/seer_finetuned/seer_regnet32_finetuned_in1k_model_final_checkpoint_phase78.torch', input_size=(3, 384, 384), pool_size=(12, 12), crop_pct=1.0), 'regnety_640.seer_ft_in1k': _cfgtv2( hf_hub_id='timm/', - license='other', origin_url='https://github.com/facebookresearch/vissl', + license='seer-license', origin_url='https://github.com/facebookresearch/vissl', url='https://dl.fbaipublicfiles.com/vissl/model_zoo/seer_finetuned/seer_regnet64_finetuned_in1k_model_final_checkpoint_phase78.torch', input_size=(3, 384, 384), pool_size=(12, 12), crop_pct=1.0), 'regnety_1280.seer_ft_in1k': _cfgtv2( hf_hub_id='timm/', - license='other', origin_url='https://github.com/facebookresearch/vissl', + license='seer-license', origin_url='https://github.com/facebookresearch/vissl', url='https://dl.fbaipublicfiles.com/vissl/model_zoo/seer_finetuned/seer_regnet128_finetuned_in1k_model_final_checkpoint_phase78.torch', input_size=(3, 384, 384), pool_size=(12, 12), crop_pct=1.0), 'regnety_2560.seer_ft_in1k': _cfgtv2( hf_hub_id='timm/', - license='other', origin_url='https://github.com/facebookresearch/vissl', + license='seer-license', origin_url='https://github.com/facebookresearch/vissl', url='https://dl.fbaipublicfiles.com/vissl/model_zoo/seer_finetuned/seer_regnet256_finetuned_in1k_model_final_checkpoint_phase38.torch', input_size=(3, 384, 384), pool_size=(12, 12), crop_pct=1.0), 'regnety_320.seer': _cfgtv2( hf_hub_id='timm/', url='https://dl.fbaipublicfiles.com/vissl/model_zoo/seer_regnet32d/seer_regnet32gf_model_iteration244000.torch', - num_classes=0, license='other', origin_url='https://github.com/facebookresearch/vissl'), + num_classes=0, license='seer-license', origin_url='https://github.com/facebookresearch/vissl'), 'regnety_640.seer': _cfgtv2( hf_hub_id='timm/', url='https://dl.fbaipublicfiles.com/vissl/model_zoo/seer_regnet64/seer_regnet64gf_model_final_checkpoint_phase0.torch', - num_classes=0, license='other', origin_url='https://github.com/facebookresearch/vissl'), + num_classes=0, license='seer-license', origin_url='https://github.com/facebookresearch/vissl'), 'regnety_1280.seer': _cfgtv2( hf_hub_id='timm/', url='https://dl.fbaipublicfiles.com/vissl/model_zoo/swav_ig1b_regnet128Gf_cnstant_bs32_node16_sinkhorn10_proto16k_syncBN64_warmup8k/model_final_checkpoint_phase0.torch', - num_classes=0, license='other', origin_url='https://github.com/facebookresearch/vissl'), + num_classes=0, license='seer-license', origin_url='https://github.com/facebookresearch/vissl'), # FIXME invalid weight <-> model match, mistake on their end #'regnety_2560.seer': _cfgtv2( # url='https://dl.fbaipublicfiles.com/vissl/model_zoo/swav_ig1b_cosine_rg256gf_noBNhead_wd1e5_fairstore_bs16_node64_sinkhorn10_proto16k_apex_syncBN64_warmup8k/model_final_checkpoint_phase0.torch', @@ -1486,4 +1486,4 @@ def regnetz_040_h(pretrained: bool = False, **kwargs) -> RegNet: register_model_deprecations(__name__, { 'regnetz_040h': 'regnetz_040_h', -}) \ No newline at end of file +}) diff --git a/timm/models/repghost.py b/timm/models/repghost.py index 779d27e037..47930ac1a9 100644 --- a/timm/models/repghost.py +++ b/timm/models/repghost.py @@ -487,6 +487,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv_stem', 'classifier': 'classifier', + 'license': 'mit', **kwargs } diff --git a/timm/models/repvit.py b/timm/models/repvit.py index 66294e5582..48800c52e0 100644 --- a/timm/models/repvit.py +++ b/timm/models/repvit.py @@ -558,6 +558,7 @@ def _cfg(url='', **kwargs): 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.conv1.c', 'classifier': ('head.head.l', 'head.head_dist.l'), + 'license': 'apache-2.0', **kwargs, } diff --git a/timm/models/res2net.py b/timm/models/res2net.py index 589bf2ddb2..28d15dc25a 100644 --- a/timm/models/res2net.py +++ b/timm/models/res2net.py @@ -139,6 +139,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv1', 'classifier': 'fc', + 'license': 'unknown', **kwargs } diff --git a/timm/models/resnest.py b/timm/models/resnest.py index 0695b38774..a4d3e7b73a 100644 --- a/timm/models/resnest.py +++ b/timm/models/resnest.py @@ -159,6 +159,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv1.0', 'classifier': 'fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/resnet.py b/timm/models/resnet.py index a92c5df6ce..41e7ce4588 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -799,6 +799,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv1', 'classifier': 'fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/resnetv2.py b/timm/models/resnetv2.py index 48c8131368..024aa8de50 100644 --- a/timm/models/resnetv2.py +++ b/timm/models/resnetv2.py @@ -899,6 +899,7 @@ def _cfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_INCEPTION_MEAN, 'std': IMAGENET_INCEPTION_STD, 'first_conv': 'stem.conv', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/selecsls.py b/timm/models/selecsls.py index 7937aeb73b..fe694938d1 100644 --- a/timm/models/selecsls.py +++ b/timm/models/selecsls.py @@ -351,6 +351,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.0', 'classifier': 'fc', + 'license': 'cc-by-4.0', **kwargs } diff --git a/timm/models/senet.py b/timm/models/senet.py index 6a1bc99eb2..f317307d34 100644 --- a/timm/models/senet.py +++ b/timm/models/senet.py @@ -448,7 +448,7 @@ def _cfg(url='', **kwargs): 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, - 'first_conv': 'layer0.conv1', 'classifier': 'last_linear', + 'first_conv': 'layer0.conv1', 'classifier': 'last_linear', 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/sequencer.py b/timm/models/sequencer.py index 1c3b21acae..180ea30c6d 100644 --- a/timm/models/sequencer.py +++ b/timm/models/sequencer.py @@ -508,6 +508,7 @@ def _cfg(url='', **kwargs): 'crop_pct': DEFAULT_CROP_PCT, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.proj', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/shvit.py b/timm/models/shvit.py index 396bc64d72..92f07f1c22 100644 --- a/timm/models/shvit.py +++ b/timm/models/shvit.py @@ -498,6 +498,7 @@ def _cfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.0.c', 'classifier': 'head.l', + 'license': 'mit', 'paper_ids': 'arXiv:2401.16456', 'paper_name': 'SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design', 'origin_url': 'https://github.com/ysj9909/SHViT', diff --git a/timm/models/sknet.py b/timm/models/sknet.py index 5884d20261..a5a4539211 100644 --- a/timm/models/sknet.py +++ b/timm/models/sknet.py @@ -185,6 +185,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'conv1', 'classifier': 'fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/starnet.py b/timm/models/starnet.py index 1cacd05cf9..e8560b6482 100644 --- a/timm/models/starnet.py +++ b/timm/models/starnet.py @@ -280,7 +280,7 @@ def _cfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'first_conv': 'stem.0.conv', 'classifier': 'head', 'paper_ids': 'arXiv:2403.19967', 'paper_name': 'Rewrite the Stars', - 'origin_url': 'https://github.com/ma-xu/Rewrite-the-Stars', + 'origin_url': 'https://github.com/ma-xu/Rewrite-the-Stars', 'license': 'apache-2.0', **kwargs } @@ -358,4 +358,4 @@ def starnet_s100(pretrained: bool = False, **kwargs: Any) -> StarNet: @register_model def starnet_s150(pretrained: bool = False, **kwargs: Any) -> StarNet: model_args = dict(base_dim=24, depths=[1, 2, 4, 2], mlp_ratio=3) - return _create_starnet('starnet_s150', pretrained=pretrained, **dict(model_args, **kwargs)) \ No newline at end of file + return _create_starnet('starnet_s150', pretrained=pretrained, **dict(model_args, **kwargs)) diff --git a/timm/models/swiftformer.py b/timm/models/swiftformer.py index 1a9900f1f0..245971d1e6 100644 --- a/timm/models/swiftformer.py +++ b/timm/models/swiftformer.py @@ -592,6 +592,7 @@ def _cfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'crop_pct': .95, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.0', 'classifier': ('head', 'head_dist'), + 'license': 'apache-2.0', 'paper_ids': 'arXiv:2303.15446', 'paper_name': 'SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications', 'origin_url': 'https://github.com/Amshaker/SwiftFormer', diff --git a/timm/models/swin_transformer_v2_cr.py b/timm/models/swin_transformer_v2_cr.py index 34aefbcebc..e99d81711d 100644 --- a/timm/models/swin_transformer_v2_cr.py +++ b/timm/models/swin_transformer_v2_cr.py @@ -1002,6 +1002,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs, } diff --git a/timm/models/tiny_vit.py b/timm/models/tiny_vit.py index a70d570f22..44a4b52be9 100644 --- a/timm/models/tiny_vit.py +++ b/timm/models/tiny_vit.py @@ -717,6 +717,7 @@ def _cfg(url='', **kwargs): 'pool_size': (7, 7), 'input_size': (3, 224, 224), 'crop_pct': 0.95, + 'license': 'apache-2.0', **kwargs, } diff --git a/timm/models/tnt.py b/timm/models/tnt.py index 85435aa465..2fee9356de 100644 --- a/timm/models/tnt.py +++ b/timm/models/tnt.py @@ -499,6 +499,7 @@ def _cfg(url='', **kwargs): 'paper_ids': 'arXiv:2103.00112', 'paper_name': 'Transformer in Transformer', 'origin_url': 'https://github.com/huawei-noah/Efficient-AI-Backbones/tree/master/tnt_pytorch', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/tresnet.py b/timm/models/tresnet.py index 7e318f6377..1dfb1c1b2e 100644 --- a/timm/models/tresnet.py +++ b/timm/models/tresnet.py @@ -389,6 +389,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': (0., 0., 0.), 'std': (1., 1., 1.), 'first_conv': 'body.conv1.conv', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/twins.py b/timm/models/twins.py index c27fd2be42..fa1a0a07ba 100644 --- a/timm/models/twins.py +++ b/timm/models/twins.py @@ -566,6 +566,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embeds.0.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/vgg.py b/timm/models/vgg.py index f51396cc2d..2545d9dc94 100644 --- a/timm/models/vgg.py +++ b/timm/models/vgg.py @@ -336,6 +336,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 0.875, 'interpolation': 'bilinear', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'features.0', 'classifier': 'head.fc', + 'license': 'bsd-3-clause', **kwargs } diff --git a/timm/models/visformer.py b/timm/models/visformer.py index 31f1015b6d..14ba70dcda 100644 --- a/timm/models/visformer.py +++ b/timm/models/visformer.py @@ -492,6 +492,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'stem.0', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/vision_transformer.py b/timm/models/vision_transformer.py index 376825f08f..1a31d8ddd5 100644 --- a/timm/models/vision_transformer.py +++ b/timm/models/vision_transformer.py @@ -1473,6 +1473,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'std': IMAGENET_INCEPTION_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs, } @@ -1870,17 +1871,21 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'vit_base_patch32_clip_224.laion400m_e32': _cfg( hf_hub_id='timm/', + license='mit', notes=('natively QuickGELU, use quickgelu model variant for original results',), mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, num_classes=512), 'vit_base_patch16_clip_224.laion400m_e32': _cfg( hf_hub_id='timm/', + license='mit', mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, crop_pct=1.0, num_classes=512), 'vit_base_patch16_plus_clip_240.laion400m_e32': _cfg( hf_hub_id='timm/', + license='mit', mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, input_size=(3, 240, 240), crop_pct=1.0, num_classes=640), 'vit_large_patch14_clip_224.laion400m_e32': _cfg( hf_hub_id='timm/', + license='mit', mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, crop_pct=1.0, num_classes=768), 'vit_base_patch32_clip_224.datacompxl': _cfg( @@ -2554,6 +2559,7 @@ def _cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'vit_intern300m_patch14_448.ogvl_dist': _cfg( hf_hub_id='timm/', + license='mit', mean=IMAGENET_DEFAULT_MEAN, std=IMAGENET_DEFAULT_STD, input_size=(3, 448, 448), crop_pct=1.0, num_classes=0, ), diff --git a/timm/models/vision_transformer_hybrid.py b/timm/models/vision_transformer_hybrid.py index b244c75589..eb255f1bd6 100644 --- a/timm/models/vision_transformer_hybrid.py +++ b/timm/models/vision_transformer_hybrid.py @@ -170,6 +170,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0.5), 'first_conv': 'patch_embed.backbone.stem.conv', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } @@ -241,6 +242,7 @@ def _cfg(url='', **kwargs): 'vit_base_mci_224.apple_mclip_lt': _cfg( hf_hub_id='apple/mobileclip_b_lt_timm', url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_blt.pt', + license='apple-amlr', num_classes=512, mean=(0., 0., 0.), std=(1., 1., 1.), first_conv='patch_embed.backbone.0.conv', ), @@ -248,6 +250,7 @@ def _cfg(url='', **kwargs): hf_hub_id='apple/mobileclip_b_timm', url='https://docs-assets.developer.apple.com/ml-research/datasets/mobileclip/mobileclip_b.pt', num_classes=512, + license='apple-amlr', mean=(0., 0., 0.), std=(1., 1., 1.), first_conv='patch_embed.backbone.0.conv', ), 'vit_base_mci_224.apple_mclip2_dfndr2b': _cfg( diff --git a/timm/models/vision_transformer_relpos.py b/timm/models/vision_transformer_relpos.py index 492d6e2727..9fdcb887f4 100644 --- a/timm/models/vision_transformer_relpos.py +++ b/timm/models/vision_transformer_relpos.py @@ -537,6 +537,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_INCEPTION_MEAN, 'std': IMAGENET_INCEPTION_STD, 'first_conv': 'patch_embed.proj', 'classifier': 'head', + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/vitamin.py b/timm/models/vitamin.py index 5fc1556a96..56882b6a43 100644 --- a/timm/models/vitamin.py +++ b/timm/models/vitamin.py @@ -325,7 +325,7 @@ def _cfg(url='', **kwargs): 'crop_pct': .9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': OPENAI_CLIP_MEAN, 'std': OPENAI_CLIP_STD, 'first_conv': 'patch_embed.backbone.stem.conv1', - 'classifier': 'head', + 'classifier': 'head', 'license': 'mit', **kwargs } @@ -623,4 +623,4 @@ def vitamin_xlarge_384(pretrained=False, **kwargs) -> VisionTransformer: img_size=384, embed_dim=1152, depth=32, num_heads=16, mlp_layer=GeGluMlp, mlp_ratio=2., class_token=False, global_pool='avg', pos_embed='none', embed_cfg=embed_cfg) model = _create_vitamin('vitamin_xlarge_384', pretrained=pretrained, **dict(model_args, **kwargs)) - return model \ No newline at end of file + return model diff --git a/timm/models/volo.py b/timm/models/volo.py index db231aeff8..205d0d432f 100644 --- a/timm/models/volo.py +++ b/timm/models/volo.py @@ -1247,6 +1247,7 @@ def _cfg(url: str = '', **kwargs: Any) -> Dict[str, Any]: 'crop_pct': .96, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.conv.0', 'classifier': ('head', 'aux_head'), + 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/vovnet.py b/timm/models/vovnet.py index ed8df58f23..4ed174a4f8 100644 --- a/timm/models/vovnet.py +++ b/timm/models/vovnet.py @@ -476,7 +476,8 @@ def _cfg(url='', **kwargs): 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bicubic', 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, - 'first_conv': 'stem.0.conv', 'classifier': 'head.fc', **kwargs, + 'first_conv': 'stem.0.conv', 'classifier': 'head.fc', + 'license': 'apache-2.0', **kwargs, } diff --git a/timm/models/xception.py b/timm/models/xception.py index 6f0b5dc590..d8edfeb17d 100644 --- a/timm/models/xception.py +++ b/timm/models/xception.py @@ -280,7 +280,8 @@ def _xception(variant, pretrained=False, **kwargs): 'std': (0.5, 0.5, 0.5), 'num_classes': 1000, 'first_conv': 'conv1', - 'classifier': 'fc' + 'classifier': 'fc', + 'license': 'apache-2.0', # The resize parameter of the validation transform should be 333, and make sure to center crop at 299x299 } }) diff --git a/timm/models/xception_aligned.py b/timm/models/xception_aligned.py index 18e1f0b4a9..1ad3bf8c39 100644 --- a/timm/models/xception_aligned.py +++ b/timm/models/xception_aligned.py @@ -358,7 +358,7 @@ def _cfg(url='', **kwargs): 'num_classes': 1000, 'input_size': (3, 299, 299), 'pool_size': (10, 10), 'crop_pct': 0.903, 'interpolation': 'bicubic', 'mean': IMAGENET_INCEPTION_MEAN, 'std': IMAGENET_INCEPTION_STD, - 'first_conv': 'stem.0.conv', 'classifier': 'head.fc', + 'first_conv': 'stem.0.conv', 'classifier': 'head.fc', 'license': 'apache-2.0', **kwargs } diff --git a/timm/models/xcit.py b/timm/models/xcit.py index 7833a8e1ca..de3deefc95 100644 --- a/timm/models/xcit.py +++ b/timm/models/xcit.py @@ -691,7 +691,7 @@ def _cfg(url='', **kwargs): 'crop_pct': 1.0, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std': IMAGENET_DEFAULT_STD, 'first_conv': 'patch_embed.proj.0.0', 'classifier': 'head', - **kwargs + 'license': 'apache-2.0', **kwargs }