From c3be79a8b7a9e90a1f6e2a0262bc480d26ccd22d Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Fri, 2 Dec 2022 17:00:00 -0800 Subject: [PATCH] Rename _pretrained.py -> pretrained.py, not feasible to change the other files to same scheme without breaking uses --- timm/models/__init__.py | 2 +- timm/models/convnext.py | 2 +- timm/models/factory.py | 2 +- timm/models/helpers.py | 2 +- timm/models/hub.py | 2 +- timm/models/maxxvit.py | 2 +- timm/models/{_pretrained.py => pretrained.py} | 0 timm/models/registry.py | 2 +- timm/models/vision_transformer.py | 2 +- timm/models/vision_transformer_hybrid.py | 2 +- 10 files changed, 9 insertions(+), 9 deletions(-) rename timm/models/{_pretrained.py => pretrained.py} (100%) diff --git a/timm/models/__init__.py b/timm/models/__init__.py index e3449103..301186dd 100644 --- a/timm/models/__init__.py +++ b/timm/models/__init__.py @@ -70,6 +70,6 @@ from .layers import TestTimePoolHead, apply_test_time_pool from .layers import convert_splitbn_model, convert_sync_batchnorm from .layers import is_scriptable, is_exportable, set_scriptable, set_exportable, is_no_jit, set_no_jit from .layers import set_fast_norm -from ._pretrained import PretrainedCfg, filter_pretrained_cfg, generate_default_cfgs, split_model_name_tag +from .pretrained import PretrainedCfg, filter_pretrained_cfg, generate_default_cfgs, split_model_name_tag from .registry import register_model, model_entrypoint, list_models, list_pretrained, is_model, list_modules,\ is_model_in_modules, is_model_pretrained, get_pretrained_cfg, get_pretrained_cfg_value diff --git a/timm/models/convnext.py b/timm/models/convnext.py index 4c89ebf2..36a484b3 100644 --- a/timm/models/convnext.py +++ b/timm/models/convnext.py @@ -21,7 +21,7 @@ from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from .helpers import named_apply, build_model_with_cfg, checkpoint_seq from .layers import trunc_normal_, SelectAdaptivePool2d, DropPath, ConvMlp, Mlp, LayerNorm2d, LayerNorm, \ create_conv2d, get_act_layer, make_divisible, to_ntuple -from ._pretrained import generate_default_cfgs +from .pretrained import generate_default_cfgs from .registry import register_model diff --git a/timm/models/factory.py b/timm/models/factory.py index 0405f435..9e06c1aa 100644 --- a/timm/models/factory.py +++ b/timm/models/factory.py @@ -2,7 +2,7 @@ import os from typing import Any, Dict, Optional, Union from urllib.parse import urlsplit -from ._pretrained import PretrainedCfg, split_model_name_tag +from .pretrained import PretrainedCfg, split_model_name_tag from .helpers import load_checkpoint from .hub import load_model_config_from_hf from .layers import set_layer_config diff --git a/timm/models/helpers.py b/timm/models/helpers.py index 60ff2b0a..2a5551e0 100644 --- a/timm/models/helpers.py +++ b/timm/models/helpers.py @@ -18,7 +18,7 @@ import torch.nn as nn from torch.hub import load_state_dict_from_url from torch.utils.checkpoint import checkpoint -from ._pretrained import PretrainedCfg +from .pretrained import PretrainedCfg from .features import FeatureListNet, FeatureDictNet, FeatureHookNet from .fx_features import FeatureGraphNet from .hub import has_hf_hub, download_cached_file, load_state_dict_from_hf diff --git a/timm/models/hub.py b/timm/models/hub.py index 2a87ae7e..18c5444a 100644 --- a/timm/models/hub.py +++ b/timm/models/hub.py @@ -15,7 +15,7 @@ except ImportError: from torch.hub import _get_torch_home as get_dir from timm import __version__ -from timm.models._pretrained import filter_pretrained_cfg +from timm.models.pretrained import filter_pretrained_cfg try: from huggingface_hub import ( diff --git a/timm/models/maxxvit.py b/timm/models/maxxvit.py index c03c7d0f..3f315093 100644 --- a/timm/models/maxxvit.py +++ b/timm/models/maxxvit.py @@ -54,7 +54,7 @@ from .layers import Mlp, ConvMlp, DropPath, ClassifierHead, trunc_normal_tf_, La from .layers import create_attn, get_act_layer, get_norm_layer, get_norm_act_layer, create_conv2d from .layers import SelectAdaptivePool2d, create_pool2d from .layers import to_2tuple, extend_tuple, make_divisible, _assert -from ._pretrained import generate_default_cfgs +from .pretrained import generate_default_cfgs from .registry import register_model from .vision_transformer_relpos import RelPosMlp, RelPosBias # FIXME move these to common location diff --git a/timm/models/_pretrained.py b/timm/models/pretrained.py similarity index 100% rename from timm/models/_pretrained.py rename to timm/models/pretrained.py diff --git a/timm/models/registry.py b/timm/models/registry.py index 00857a03..159ffb5f 100644 --- a/timm/models/registry.py +++ b/timm/models/registry.py @@ -9,7 +9,7 @@ from collections import defaultdict, deque from copy import deepcopy from typing import List, Optional, Union, Tuple -from ._pretrained import PretrainedCfg, DefaultCfg, split_model_name_tag +from .pretrained import PretrainedCfg, DefaultCfg, split_model_name_tag __all__ = [ 'list_models', 'is_model', 'model_entrypoint', 'list_modules', 'is_model_in_modules', diff --git a/timm/models/vision_transformer.py b/timm/models/vision_transformer.py index 3e667eef..eea7ebb8 100644 --- a/timm/models/vision_transformer.py +++ b/timm/models/vision_transformer.py @@ -34,7 +34,7 @@ from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_INCE OPENAI_CLIP_MEAN, OPENAI_CLIP_STD from .helpers import build_model_with_cfg, named_apply, adapt_input_conv, checkpoint_seq from .layers import PatchEmbed, Mlp, DropPath, trunc_normal_, lecun_normal_ -from ._pretrained import generate_default_cfgs +from .pretrained import generate_default_cfgs from .registry import register_model _logger = logging.getLogger(__name__) diff --git a/timm/models/vision_transformer_hybrid.py b/timm/models/vision_transformer_hybrid.py index b4c7d9e7..5e5113d7 100644 --- a/timm/models/vision_transformer_hybrid.py +++ b/timm/models/vision_transformer_hybrid.py @@ -20,8 +20,8 @@ import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD -from ._pretrained import generate_default_cfgs from .layers import StdConv2dSame, StdConv2d, to_2tuple +from .pretrained import generate_default_cfgs from .resnet import resnet26d, resnet50d from .resnetv2 import ResNetV2, create_resnetv2_stem from .registry import register_model