timm
  • 🌍GET STARTED
    • Home
    • Quickstart
    • Installation
  • 🌍TUTORIALS
    • Using Pretrained Models as Feature Extractors
    • Training With The Official Training Script
    • Share and Load Models from the BOINC AI Hub
  • 🌍MODEL PAGES
    • Model Summaries
    • Results
    • Adversarial Inception v3
    • AdvProp (EfficientNet)
    • Big Transfer (BiT)
    • CSP-DarkNet
    • CSP-ResNet
    • CSP-ResNeXt
    • DenseNet
    • Deep Layer Aggregation
    • Dual Path NetwORK(DPN)
    • ECA-ResNet
    • EfficientNet
    • EfficientNet (Knapsack Pruned)
    • Ensemble Adversarial Inception ResNet v2
    • ESE-VoVNet
    • FBNet
    • (Gluon) Inception v3
    • (Gluon) ResNet
    • (Gluon) ResNeXt
    • (Gluon) SENet
    • (Gluon) SE-ResNeXt
    • (Gluon) Xception
    • HRNet
    • Instagram ResNeXt WSL
    • Inception ResNet v2
    • Inception v3
    • Inception v4
    • (Legacy) SE-ResNet
    • (Legacy) SE-ResNeXt
    • (Legacy) SENet
    • MixNet
    • MnasNet
    • MobileNet v2
    • MobileNet v3
    • NASNet
    • Noisy Student (EfficientNet)
    • PNASNet
    • RegNetX
    • RegNetY
    • Res2Net
    • Res2NeXt
    • ResNeSt
    • ResNet
    • ResNet-D
    • ResNeXt
    • RexNet
    • SE-ResNet
    • SelecSLS
    • SE-ResNeXt
    • SK-ResNet
    • SK-ResNeXt
    • SPNASNet
    • SSL ResNet
    • SWSL ResNet
    • SWSL ResNeXt
    • (Tensorflow) EfficientNet
    • (Tensorflow) EfficientNet CondConv
    • (Tensorflow) EfficientNet Lite
    • (Tensorflow) MobileNet v3
    • (Tensorflow) MixNet
    • (Tensorflow) MobileNet v3
    • TResNet
    • Wide ResNet
    • Xception
  • 🌍REFERENCE
    • Models
    • Data
    • Optimizers
    • Learning Rate Schedulers
Powered by GitBook
On this page
  1. REFERENCE

Models

PreviousREFERENCENextData

Last updated 1 year ago

Models

timm.create_model

( model_name: strpretrained: bool = Falsepretrained_cfg: typing.Union[str, typing.Dict[str, typing.Any], timm.models._pretrained.PretrainedCfg, NoneType] = Nonepretrained_cfg_overlay: typing.Union[typing.Dict[str, typing.Any], NoneType] = Nonecheckpoint_path: str = ''scriptable: typing.Optional[bool] = Noneexportable: typing.Optional[bool] = Noneno_jit: typing.Optional[bool] = None**kwargs )

Create a model.

Lookup model’s entrypoint function and pass relevant args to create a new model.

**kwargs will be passed through entrypoint fn to `timm.models.build_model_with_cfg()` and then the model class __init__(). kwargs values set to None are pruned before passing.

Keyword Args: drop_rate (float): Classifier dropout rate for training. drop_path_rate (float): Stochastic depth drop rate for training. global_pool (str): Classifier global pooling type.

Example:

Copied

>>> from timm import create_model

>>> # Create a MobileNetV3-Large model with no pretrained weights.
>>> model = create_model('mobilenetv3_large_100')

>>> # Create a MobileNetV3-Large model with pretrained weights.
>>> model = create_model('mobilenetv3_large_100', pretrained=True)
>>> model.num_classes
1000

>>> # Create a MobileNetV3-Large model with pretrained weights and a new head with 10 classes.
>>> model = create_model('mobilenetv3_large_100', pretrained=True, num_classes=10)
>>> model.num_classes
10

timm.list_models

( filter: typing.Union[str, typing.List[str]] = ''module: str = ''pretrained: bool = Falseexclude_filters: typing.Union[str, typing.List[str]] = ''name_matches_cfg: bool = Falseinclude_tags: typing.Optional[bool] = None )

Parameters

  • filter - Wildcard filter string that works with fnmatch —

  • module - Limit model selection to a specific submodule (ie ‘vision_transformer’) —

  • pretrained - Include only models with valid pretrained weights if True —

  • exclude_filters - Wildcard filters to exclude models after including them with filter —

  • name_matches_cfg - Include only models w/ model_name matching default_cfg name (excludes some aliases) —

  • include_tags - Include pretrained tags in model names (model.tag). If None, defaults — set to True when pretrained=True else False (default: None)

Return list of available model names, sorted alphabetically

Example: model_list(‘gluon_resnet’) — returns all models starting with ‘gluon_resnet’ model_list(’resnext*, ‘resnet’) — returns all models with ‘resnext’ in ‘resnet’ module

🌍
<source>
<source>