📝 wip docs

pull/1575/head
nateraw 3 years ago
parent 9c2c5bfaaa
commit ecaa5d9c9f

@ -9,36 +9,14 @@
- sections: - sections:
- local: inference - local: inference
title: Using Pretrained Models for Inference title: Using Pretrained Models for Inference
- local: feature_extraction
title: Using Pretrained Models as Feature Extractors
- local: training_script - local: training_script
title: Training With The Official Training Script title: Training With The Official Training Script
- local: hf_hub - local: hf_hub
title: Share and Load Models from the Hugging Face Hub title: Share and Load Models from the Hugging Face Hub
title: Tutorials title: Tutorials
- sections: - sections:
- local: reference/models
title: Models
- local: reference/augmentation
title: Augmentation
- local: reference/data
title: Data
- local: reference/optimization
title: Optimization
title: Reference
- sections:
- local: models
title: Model Summaries
- local: results
title: Results
- local: scripts
title: Scripts
- local: training_hparam_examples
title: Training Examples
- local: feature_extraction
title: Feature Extraction
- local: changes
title: Recent Changes
- local: archived_changes
title: Archived Changes
- local: model_pages - local: model_pages
title: Model Pages title: Model Pages
isExpanded: false isExpanded: false
@ -169,4 +147,28 @@
title: Wide ResNet title: Wide ResNet
- local: models/xception - local: models/xception
title: Xception title: Xception
title: Available Models
- sections:
- local: reference/models
title: Models
- local: reference/augmentation
title: Augmentation
- local: reference/data
title: Data
- local: reference/optimization
title: Optimization
title: Reference
- sections:
- local: models
title: Model Summaries
- local: results
title: Results
- local: scripts
title: Scripts
- local: training_hparam_examples
title: Training Examples
- local: changes
title: Recent Changes
- local: archived_changes
title: Archived Changes
title: Legacy Docs title: Legacy Docs

@ -1,5 +1,13 @@
# Quickstart # Quickstart
This quickstart is intended for developers who are ready to dive into the code and see an example of how to integrate `timm` into their model training workflow.
First, you'll need to install `timm`. For more information on installation, see [Installation](installation).
```bash
pip install timm
```
## Load a Pretrained Model ## Load a Pretrained Model
Pretrained models can be loaded using `timm.create_model` Pretrained models can be loaded using `timm.create_model`
@ -11,8 +19,36 @@ Pretrained models can be loaded using `timm.create_model`
>>> m.eval() >>> m.eval()
``` ```
## Fine-Tune a Pretrained Model
You can finetune any of the pre-trained models just by changing the classifier (the last layer).
```py
>>> model = timm.create_model('mobilenetv3_large_100', pretrained=True, num_classes=NUM_FINETUNE_CLASSES)
```
To fine-tune on your own dataset, you have to write a PyTorch training loop or adapt `timm`'s [training script](training_script) to use your dataset.
## Use a Pretrained Model for Feature Extraction
Without modifying the network, one can call model.forward_features(input) on any model instead of the usual model(input). This will bypass the head classifier and global pooling for networks.
For a more in depth guide to using `timm` for feature extraction, see [Feature Extraction](feature_extraction).
```py
>>> import timm
>>> import torch
>>> x = torch.randn(1, 3, 224, 224)
>>> model = timm.create_model('mobilenetv3_large_100', pretrained=True)
>>> features = model.forward_features(x)
>>> print(features.shape)
torch.Size([1, 960, 7, 7])
```
## List Models with Pretrained Weights ## List Models with Pretrained Weights
You can list all models with pretrained weights using `timm.list_models`.
```py ```py
>>> import timm >>> import timm
>>> from pprint import pprint >>> from pprint import pprint
@ -32,7 +68,7 @@ Pretrained models can be loaded using `timm.create_model`
] ]
``` ```
## List Model Architectures by Wildcard You can also list models with a specific pattern in their name.
```py ```py
>>> import timm >>> import timm

Loading…
Cancel
Save