diff --git a/timm/models/_hub.py b/timm/models/_hub.py index c77b04d854..22a6487676 100644 --- a/timm/models/_hub.py +++ b/timm/models/_hub.py @@ -32,9 +32,9 @@ try: from huggingface_hub import ( create_repo, get_hf_file_metadata, - hf_hub_download, hf_hub_url, + hf_hub_download, hf_hub_url, model_info, repo_type_and_id_from_hf_id, upload_folder) - from huggingface_hub.utils import EntryNotFoundError + 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: @@ -540,3 +540,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 5b5973801d..78c2c85efd 100644 --- a/timm/models/beit.py +++ b/timm/models/beit.py @@ -738,6 +738,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 e37d25b6ef..26ec77ade9 100644 --- a/timm/models/byobnet.py +++ b/timm/models/byobnet.py @@ -2279,6 +2279,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 } @@ -2298,6 +2299,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 } @@ -2451,26 +2453,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 @@ -2479,48 +2486,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 @@ -2528,41 +2543,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 2c500ec3dd..bb28dfe574 100644 --- a/timm/models/cait.py +++ b/timm/models/cait.py @@ -472,6 +472,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 e0b0bcfb84..aaf0a90a52 100644 --- a/timm/models/coat.py +++ b/timm/models/coat.py @@ -720,6 +720,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 } @@ -800,4 +801,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 cbe3b51ece..262b2a82a6 100644 --- a/timm/models/convit.py +++ b/timm/models/convit.py @@ -391,7 +391,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 de986e3baf..f13300ff22 100644 --- a/timm/models/convmixer.py +++ b/timm/models/convmixer.py @@ -115,7 +115,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 } @@ -143,4 +143,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 cdc34eba2f..a8f193baee 100644 --- a/timm/models/convnext.py +++ b/timm/models/convnext.py @@ -665,7 +665,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 } @@ -1067,25 +1067,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 0e1de2fadd..bacc9ba068 100644 --- a/timm/models/crossvit.py +++ b/timm/models/crossvit.py @@ -489,6 +489,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 81d11a0654..7c8ac71dcf 100644 --- a/timm/models/cspnet.py +++ b/timm/models/cspnet.py @@ -917,7 +917,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 } @@ -1111,4 +1111,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 22b4a1a05f..ae7c8880df 100644 --- a/timm/models/davit.py +++ b/timm/models/davit.py @@ -806,6 +806,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 0072013bf6..b1e0ae918f 100644 --- a/timm/models/deit.py +++ b/timm/models/deit.py @@ -140,6 +140,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 1a9f9887a5..0c14b9f42e 100644 --- a/timm/models/densenet.py +++ b/timm/models/densenet.py @@ -472,7 +472,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 197060e4e6..465644e149 100644 --- a/timm/models/dla.py +++ b/timm/models/dla.py @@ -399,7 +399,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 } @@ -415,8 +415,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 c03e5fe1a1..87a851e594 100644 --- a/timm/models/dpn.py +++ b/timm/models/dpn.py @@ -295,7 +295,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 333f73f0d5..18de7c22f0 100644 --- a/timm/models/edgenext.py +++ b/timm/models/edgenext.py @@ -560,6 +560,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 669062d365..a1a9064e16 100644 --- a/timm/models/efficientformer.py +++ b/timm/models/efficientformer.py @@ -590,6 +590,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 39c832c8c2..3e51aa2f67 100644 --- a/timm/models/efficientformer_v2.py +++ b/timm/models/efficientformer_v2.py @@ -726,6 +726,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 d1976944da..08a0dbad95 100644 --- a/timm/models/efficientnet.py +++ b/timm/models/efficientnet.py @@ -1312,7 +1312,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 8b35a04c87..f46eb0763b 100644 --- a/timm/models/efficientvit_mit.py +++ b/timm/models/efficientvit_mit.py @@ -998,6 +998,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 80c5d99995..4f3b7e3bed 100644 --- a/timm/models/efficientvit_msra.py +++ b/timm/models/efficientvit_msra.py @@ -598,6 +598,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 1cd690b06c..58aecf6765 100644 --- a/timm/models/eva.py +++ b/timm/models/eva.py @@ -1256,7 +1256,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 } @@ -1276,7 +1276,7 @@ def _dinov3_cfg(url: str = '', **kwargs) -> Dict[str, Any]: 'crop_pct': 1.0, 'interpolation': 'bicubic', 'min_input_size': (3, 128, 128), '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({ @@ -2538,7 +2538,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 b9e4aed249..07c1a00d9e 100644 --- a/timm/models/fasternet.py +++ b/timm/models/fasternet.py @@ -405,6 +405,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 9939095c43..de4c67b21b 100644 --- a/timm/models/fastvit.py +++ b/timm/models/fastvit.py @@ -1360,6 +1360,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", @@ -1410,21 +1411,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( @@ -1732,4 +1733,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 367e5dfff5..ad85f93be0 100644 --- a/timm/models/gcvit.py +++ b/timm/models/gcvit.py @@ -582,6 +582,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 126d638f43..02fb224a93 100644 --- a/timm/models/ghostnet.py +++ b/timm/models/ghostnet.py @@ -850,6 +850,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 5c49f9ddca..0e772800d1 100644 --- a/timm/models/hgnet.py +++ b/timm/models/hgnet.py @@ -694,6 +694,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 fa9d6d2833..fe335fd710 100644 --- a/timm/models/hiera.py +++ b/timm/models/hiera.py @@ -818,6 +818,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 cd8bc6c8e9..a3dfdafad8 100644 --- a/timm/models/hieradet_sam2.py +++ b/timm/models/hieradet_sam2.py @@ -532,6 +532,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 92ee3511cf..0e54559f14 100644 --- a/timm/models/hrnet.py +++ b/timm/models/hrnet.py @@ -888,14 +888,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 3159ac03be..9405c40f43 100644 --- a/timm/models/inception_next.py +++ b/timm/models/inception_next.py @@ -427,6 +427,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 d691be7a8f..2f4b91e324 100644 --- a/timm/models/inception_resnet_v2.py +++ b/timm/models/inception_resnet_v2.py @@ -317,6 +317,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 @@ -326,6 +327,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 a55521c3de..10b37dfaff 100644 --- a/timm/models/inception_v3.py +++ b/timm/models/inception_v3.py @@ -418,7 +418,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 } @@ -454,4 +454,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 cadbf95284..472052e398 100644 --- a/timm/models/inception_v4.py +++ b/timm/models/inception_v4.py @@ -378,6 +378,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 a4c9ce628a..7981765c92 100644 --- a/timm/models/levit.py +++ b/timm/models/levit.py @@ -842,6 +842,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 b28827ed71..5e838cf3a1 100644 --- a/timm/models/mambaout.py +++ b/timm/models/mambaout.py @@ -526,6 +526,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 85cc3b4238..c58de60063 100644 --- a/timm/models/maxxvit.py +++ b/timm/models/maxxvit.py @@ -2079,7 +2079,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 3364a79563..efbaa6e4d4 100644 --- a/timm/models/metaformer.py +++ b/timm/models/metaformer.py @@ -740,6 +740,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 838e0e0117..cb76f17284 100644 --- a/timm/models/mlp_mixer.py +++ b/timm/models/mlp_mixer.py @@ -560,6 +560,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 eb87bb38d8..0c2969099c 100644 --- a/timm/models/mobilenetv3.py +++ b/timm/models/mobilenetv3.py @@ -1032,7 +1032,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 8a3e132d1e..9a0e2ec93d 100644 --- a/timm/models/mobilenetv5.py +++ b/timm/models/mobilenetv5.py @@ -826,7 +826,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 9c84871e6d..f16b35bd80 100644 --- a/timm/models/mobilevit.py +++ b/timm/models/mobilevit.py @@ -567,6 +567,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 } @@ -678,4 +679,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 01c4550ed8..7e08655e27 100644 --- a/timm/models/mvitv2.py +++ b/timm/models/mvitv2.py @@ -1051,6 +1051,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 8edee45c86..040d72f1e6 100644 --- a/timm/models/nasnet.py +++ b/timm/models/nasnet.py @@ -586,6 +586,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 9a423a9776..2555154a85 100644 --- a/timm/models/nest.py +++ b/timm/models/nest.py @@ -571,6 +571,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 402a9d76ea..70629bb4b0 100644 --- a/timm/models/nextvit.py +++ b/timm/models/nextvit.py @@ -683,6 +683,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 68b8b1b6d6..93814995c4 100644 --- a/timm/models/nfnet.py +++ b/timm/models/nfnet.py @@ -824,7 +824,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 } @@ -1170,4 +1170,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 b7985cf998..04b24ca09e 100644 --- a/timm/models/pit.py +++ b/timm/models/pit.py @@ -393,6 +393,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 7f33aaeabb..51faba8b72 100644 --- a/timm/models/pnasnet.py +++ b/timm/models/pnasnet.py @@ -363,6 +363,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 0259a1f64e..d242ce8b7a 100644 --- a/timm/models/pvt_v2.py +++ b/timm/models/pvt_v2.py @@ -500,6 +500,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 5764b6ed82..81bfa3b25f 100644 --- a/timm/models/rdnet.py +++ b/timm/models/rdnet.py @@ -434,6 +434,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 f05bad37ba..ed82c8dfa7 100644 --- a/timm/models/regnet.py +++ b/timm/models/regnet.py @@ -1011,7 +1011,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 } @@ -1173,37 +1173,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', @@ -1464,4 +1464,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 c5a7d93a4f..64facda4c8 100644 --- a/timm/models/repghost.py +++ b/timm/models/repghost.py @@ -456,6 +456,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 3641d6f70c..f071e4b26f 100644 --- a/timm/models/repvit.py +++ b/timm/models/repvit.py @@ -440,6 +440,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 691f929b91..d55647410b 100644 --- a/timm/models/res2net.py +++ b/timm/models/res2net.py @@ -127,6 +127,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 5b1438017e..3b4eff64b3 100644 --- a/timm/models/resnest.py +++ b/timm/models/resnest.py @@ -133,6 +133,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 ca07682b80..6add0a846e 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -748,6 +748,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 0b78e7b44d..efb1595947 100644 --- a/timm/models/resnetv2.py +++ b/timm/models/resnetv2.py @@ -872,6 +872,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 dc19ff41d1..e49851473a 100644 --- a/timm/models/selecsls.py +++ b/timm/models/selecsls.py @@ -321,6 +321,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 9884c61419..e9a48db1f8 100644 --- a/timm/models/senet.py +++ b/timm/models/senet.py @@ -372,7 +372,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 86c4b1df4d..94da5cf002 100644 --- a/timm/models/sequencer.py +++ b/timm/models/sequencer.py @@ -478,6 +478,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 c165f1a280..9bfd15014e 100644 --- a/timm/models/shvit.py +++ b/timm/models/shvit.py @@ -463,6 +463,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 b12df2319f..d305183691 100644 --- a/timm/models/sknet.py +++ b/timm/models/sknet.py @@ -157,6 +157,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 9ed32a85d7..7d6b55a001 100644 --- a/timm/models/starnet.py +++ b/timm/models/starnet.py @@ -267,7 +267,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 } @@ -345,4 +345,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 38df6f1638..2323dae392 100644 --- a/timm/models/swiftformer.py +++ b/timm/models/swiftformer.py @@ -555,6 +555,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 1ef3164fd9..f3a2aa22f8 100644 --- a/timm/models/swin_transformer_v2_cr.py +++ b/timm/models/swin_transformer_v2_cr.py @@ -962,6 +962,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 39bacc850c..1891d85499 100644 --- a/timm/models/tiny_vit.py +++ b/timm/models/tiny_vit.py @@ -640,6 +640,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 0ecd8e72a4..01e07446ed 100644 --- a/timm/models/tnt.py +++ b/timm/models/tnt.py @@ -471,6 +471,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 2c452e4707..ece735df20 100644 --- a/timm/models/tresnet.py +++ b/timm/models/tresnet.py @@ -353,6 +353,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 74d22e24c1..d138b7c624 100644 --- a/timm/models/twins.py +++ b/timm/models/twins.py @@ -519,6 +519,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 23c8834894..0085a2b439 100644 --- a/timm/models/vgg.py +++ b/timm/models/vgg.py @@ -328,6 +328,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 2ed3be5da8..0392f73a98 100644 --- a/timm/models/visformer.py +++ b/timm/models/visformer.py @@ -452,6 +452,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 1c21d4ffb2..70dd41d5ac 100644 --- a/timm/models/vision_transformer.py +++ b/timm/models/vision_transformer.py @@ -1474,6 +1474,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, } @@ -1869,17 +1870,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( @@ -2553,6 +2558,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 7290bb7697..525c38cee0 100644 --- a/timm/models/vision_transformer_hybrid.py +++ b/timm/models/vision_transformer_hybrid.py @@ -150,6 +150,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 } @@ -221,6 +222,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', ), @@ -228,6 +230,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 dcccba73ba..70a5c7f0d6 100644 --- a/timm/models/vision_transformer_relpos.py +++ b/timm/models/vision_transformer_relpos.py @@ -516,6 +516,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 fa76275426..ed4f67d107 100644 --- a/timm/models/vitamin.py +++ b/timm/models/vitamin.py @@ -303,7 +303,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 } @@ -601,4 +601,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 f417dc6df1..ab70c3f77b 100644 --- a/timm/models/volo.py +++ b/timm/models/volo.py @@ -1189,6 +1189,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 8da9431f09..eb1081fb54 100644 --- a/timm/models/vovnet.py +++ b/timm/models/vovnet.py @@ -466,7 +466,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 e1f92abfa0..f64e9e4dd1 100644 --- a/timm/models/xception.py +++ b/timm/models/xception.py @@ -239,7 +239,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 3c67fa8036..77a405d7b6 100644 --- a/timm/models/xception_aligned.py +++ b/timm/models/xception_aligned.py @@ -312,7 +312,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 271578adf8..794451dc25 100644 --- a/timm/models/xcit.py +++ b/timm/models/xcit.py @@ -612,7 +612,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 }