Skip to content

Commit 8d81fdf

Browse files
JosuaRiederrwightman
authored andcommitted
Fix typos
1 parent 3677f67 commit 8d81fdf

33 files changed

+48
-48
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Code linting and auto-format (black) are not currently in place but open to cons
1010

1111
A few specific differences from Google style (or black)
1212
1. Line length is 120 char. Going over is okay in some cases (e.g. I prefer not to break URL across lines).
13-
2. Hanging indents are always prefered, please avoid aligning arguments with closing brackets or braces.
13+
2. Hanging indents are always preferred, please avoid aligning arguments with closing brackets or braces.
1414

1515
Example, from Google guide, but this is a NO here:
1616
```

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Add a set of new very well trained ResNet & ResNet-V2 18/34 (basic block) weight
238238
### May 14, 2024
239239
* Support loading PaliGemma jax weights into SigLIP ViT models with average pooling.
240240
* Add Hiera models from Meta (https://github.com/facebookresearch/hiera).
241-
* Add `normalize=` flag for transorms, return non-normalized torch.Tensor with original dytpe (for `chug`)
241+
* Add `normalize=` flag for transforms, return non-normalized torch.Tensor with original dytpe (for `chug`)
242242
* Version 1.0.3 release
243243

244244
### May 11, 2024

hfdocs/source/changes.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
### May 14, 2024
9494
* Support loading PaliGemma jax weights into SigLIP ViT models with average pooling.
9595
* Add Hiera models from Meta (https://github.com/facebookresearch/hiera).
96-
* Add `normalize=` flag for transorms, return non-normalized torch.Tensor with original dytpe (for `chug`)
96+
* Add `normalize=` flag for transforms, return non-normalized torch.Tensor with original dytpe (for `chug`)
9797
* Version 1.0.3 release
9898

9999
### May 11, 2024
@@ -125,7 +125,7 @@
125125
### April 11, 2024
126126
* Prepping for a long overdue 1.0 release, things have been stable for a while now.
127127
* Significant feature that's been missing for a while, `features_only=True` support for ViT models with flat hidden states or non-std module layouts (so far covering `'vit_*', 'twins_*', 'deit*', 'beit*', 'mvitv2*', 'eva*', 'samvit_*', 'flexivit*'`)
128-
* Above feature support achieved through a new `forward_intermediates()` API that can be used with a feature wrapping module or direclty.
128+
* Above feature support achieved through a new `forward_intermediates()` API that can be used with a feature wrapping module or directly.
129129
```python
130130
model = timm.create_model('vit_base_patch16_224')
131131
final_feat, intermediates = model.forward_intermediates(input)
@@ -360,7 +360,7 @@ Datasets & transform refactoring
360360
* 0.8.15dev0
361361

362362
### Feb 20, 2023
363-
* Add 320x320 `convnext_large_mlp.clip_laion2b_ft_320` and `convnext_lage_mlp.clip_laion2b_ft_soup_320` CLIP image tower weights for features & fine-tune
363+
* Add 320x320 `convnext_large_mlp.clip_laion2b_ft_320` and `convnext_large_mlp.clip_laion2b_ft_soup_320` CLIP image tower weights for features & fine-tune
364364
* 0.8.13dev0 pypi release for latest changes w/ move to huggingface org
365365

366366
### Feb 16, 2023
@@ -745,7 +745,7 @@ More models, more fixes
745745
* Add 'group matching' API to all models to allow grouping model parameters for application of 'layer-wise' LR decay, lr scale added to LR scheduler
746746
* Gradient checkpointing support added to many models
747747
* `forward_head(x, pre_logits=False)` fn added to all models to allow separate calls of `forward_features` + `forward_head`
748-
* All vision transformer and vision MLP models update to return non-pooled / non-token selected features from `foward_features`, for consistency with CNN models, token selection or pooling now applied in `forward_head`
748+
* All vision transformer and vision MLP models update to return non-pooled / non-token selected features from `forward_features`, for consistency with CNN models, token selection or pooling now applied in `forward_head`
749749

750750
### Feb 2, 2022
751751
* [Chris Hughes](https://github.com/Chris-hughes10) posted an exhaustive run through of `timm` on his blog yesterday. Well worth a read. [Getting Started with PyTorch Image Models (timm): A Practitioner’s Guide](https://towardsdatascience.com/getting-started-with-pytorch-image-models-timm-a-practitioners-guide-4e77b4bf9055)
@@ -1058,7 +1058,7 @@ More models, more fixes
10581058
* Add 'group matching' API to all models to allow grouping model parameters for application of 'layer-wise' LR decay, lr scale added to LR scheduler
10591059
* Gradient checkpointing support added to many models
10601060
* `forward_head(x, pre_logits=False)` fn added to all models to allow separate calls of `forward_features` + `forward_head`
1061-
* All vision transformer and vision MLP models update to return non-pooled / non-token selected features from `foward_features`, for consistency with CNN models, token selection or pooling now applied in `forward_head`
1061+
* All vision transformer and vision MLP models update to return non-pooled / non-token selected features from `forward_features`, for consistency with CNN models, token selection or pooling now applied in `forward_head`
10621062

10631063
### Feb 2, 2022
10641064
* [Chris Hughes](https://github.com/Chris-hughes10) posted an exhaustive run through of `timm` on his blog yesterday. Well worth a read. [Getting Started with PyTorch Image Models (timm): A Practitioner’s Guide](https://towardsdatascience.com/getting-started-with-pytorch-image-models-timm-a-practitioners-guide-4e77b4bf9055)

hfdocs/source/models/adversarial-inception-v3.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Adversarial Inception v3
22

3-
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
3+
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifier](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
44

55
This particular model was trained for study of adversarial examples (adversarial training).
66

hfdocs/source/models/gloun-inception-v3.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# (Gluon) Inception v3
22

3-
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
3+
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifier](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
44

55
The weights from this model were ported from [Gluon](https://cv.gluon.ai/model_zoo/classification.html).
66

hfdocs/source/models/inception-v3.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Inception v3
22

3-
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
3+
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifier](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
44

55
## How do I use this model on an image?
66

hfdocs/source/models/tf-inception-v3.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# (Tensorflow) Inception v3
22

3-
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
3+
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifier](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module).
44

55
The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models).
66

timm/data/auto_augment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ def augment_and_mix_transform(config_str: str, hparams: Optional[Dict] = None):
954954
Args:
955955
config_str (str): String defining configuration of random augmentation. Consists of multiple sections separated
956956
by dashes ('-'). The first section defines the specific variant of rand augment (currently only 'rand').
957-
The remaining sections, not order sepecific determine
957+
The remaining sections, not order specific determine
958958
'm' - integer magnitude (severity) of augmentation mix (default: 3)
959959
'w' - integer width of augmentation chain (default: 3)
960960
'd' - integer depth of augmentation chain (-1 is random [1, 3], default: -1)

timm/data/imagenet_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self, subset: str = 'imagenet-1k'):
5252
subset = re.sub(r'[-_\s]', '', subset.lower())
5353
assert subset in _SUBSETS, f'Unknown imagenet subset {subset}.'
5454

55-
# WordNet synsets (part-of-speach + offset) are the unique class label names for ImageNet classifiers
55+
# WordNet synsets (part-of-speech + offset) are the unique class label names for ImageNet classifiers
5656
synset_file = _SUBSETS[subset]
5757
synset_data = pkgutil.get_data(__name__, os.path.join('_info', synset_file))
5858
self._synsets = synset_data.decode('utf-8').splitlines()

timm/data/readers/reader_hfids.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(
8080
self.num_samples = split_info.num_examples
8181
else:
8282
raise ValueError(
83-
"Dataset length is unknown, please pass `num_samples` explicitely. "
83+
"Dataset length is unknown, please pass `num_samples` explicitly. "
8484
"The number of steps needs to be known in advance for the learning rate scheduler."
8585
)
8686

timm/data/readers/reader_image_folder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def find_images_and_targets(
2525
""" Walk folder recursively to discover images and map them to classes by folder names.
2626
2727
Args:
28-
folder: root of folder to recrusively search
28+
folder: root of folder to recursively search
2929
types: types (file extensions) to search for in path
3030
class_to_idx: specify mapping for class (folder name) to class index if set
3131
leaf_name_only: use only leaf-name of folder walk for class names

timm/data/readers/reader_wds.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _info_convert(dict_info):
124124

125125

126126
def log_and_continue(exn):
127-
"""Call in an exception handler to ignore exceptions, isssue a warning, and continue."""
127+
"""Call in an exception handler to ignore exceptions, issue a warning, and continue."""
128128
_logger.warning(f'Handling webdataset error ({repr(exn)}). Ignoring.')
129129
# NOTE: try force an exit on errors that are clearly code / config and not transient
130130
if isinstance(exn, TypeError):
@@ -277,7 +277,7 @@ def __init__(
277277
target_img_mode: str = '',
278278
filename_key: str = 'filename',
279279
sample_shuffle_size: Optional[int] = None,
280-
smaple_initial_size: Optional[int] = None,
280+
sample_initial_size: Optional[int] = None,
281281
):
282282
super().__init__()
283283
if wds is None:
@@ -290,7 +290,7 @@ def __init__(
290290
self.common_seed = seed # a seed that's fixed across all worker / distributed instances
291291
self.shard_shuffle_size = 500
292292
self.sample_shuffle_size = sample_shuffle_size or SAMPLE_SHUFFLE_SIZE
293-
self.sample_initial_size = smaple_initial_size or SAMPLE_INITIAL_SIZE
293+
self.sample_initial_size = sample_initial_size or SAMPLE_INITIAL_SIZE
294294

295295
self.input_key = input_key
296296
self.input_img_mode = input_img_mode

timm/layers/activations.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def sigmoid(x, inplace: bool = False):
4747
return x.sigmoid_() if inplace else x.sigmoid()
4848

4949

50-
# PyTorch has this, but not with a consistent inplace argmument interface
50+
# PyTorch has this, but not with a consistent inplace argument interface
5151
class Sigmoid(nn.Module):
5252
def __init__(self, inplace: bool = False):
5353
super(Sigmoid, self).__init__()
@@ -61,7 +61,7 @@ def tanh(x, inplace: bool = False):
6161
return x.tanh_() if inplace else x.tanh()
6262

6363

64-
# PyTorch has this, but not with a consistent inplace argmument interface
64+
# PyTorch has this, but not with a consistent inplace argument interface
6565
class Tanh(nn.Module):
6666
def __init__(self, inplace: bool = False):
6767
super(Tanh, self).__init__()

timm/layers/attention2d.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MultiQueryAttentionV2(nn.Module):
1616
Fast Transformer Decoding: One Write-Head is All You Need
1717
https://arxiv.org/pdf/1911.02150.pdf
1818
19-
This is an acceletor optimized version - removing multiple unneccessary
19+
This is an acceletor optimized version - removing multiple unnecessary
2020
tensor transpose by re-arranging indices according to the following rules: 1)
2121
contracted indices are at the end, 2) other indices have the same order in the
2222
input and output tensores.
@@ -87,7 +87,7 @@ class MultiQueryAttention2d(nn.Module):
8787
2. query_strides: horizontal & vertical strides on Query only.
8888
8989
This is an optimized version.
90-
1. Projections in Attention is explict written out as 1x1 Conv2D.
90+
1. Projections in Attention is explicit written out as 1x1 Conv2D.
9191
2. Additional reshapes are introduced to bring a up to 3x speed up.
9292
"""
9393
fused_attn: torch.jit.Final[bool]

timm/layers/create_norm_act.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" NormAct (Normalizaiton + Activation Layer) Factory
1+
""" NormAct (Normalization + Activation Layer) Factory
22
33
Create norm + act combo modules that attempt to be backwards compatible with separate norm + act
4-
isntances in models. Where these are used it will be possible to swap separate BN + act layers with
4+
instances in models. Where these are used it will be possible to swap separate BN + act layers with
55
combined modules like IABN or EvoNorms.
66
77
Hacked together by / Copyright 2020 Ross Wightman

timm/layers/weight_init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def trunc_normal_tf_(tensor, mean=0., std=1., a=-2., b=2.):
7878
7979
NOTE: this 'tf' variant behaves closer to Tensorflow / JAX impl where the
8080
bounds [a, b] are applied when sampling the normal distribution with mean=0, std=1.0
81-
and the result is subsquently scaled and shifted by the mean and std args.
81+
and the result is subsequently scaled and shifted by the mean and std args.
8282
8383
Args:
8484
tensor: an n-dimensional `torch.Tensor`

timm/models/_efficientnet_blocks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def __init__(
490490
# https://arxiv.org/abs/2102.10882
491491
# 1. Rather than adding one CPE before the attention blocks, we add a CPE
492492
# into every attention block.
493-
# 2. We replace the expensive Conv2D by a Seperable DW Conv.
493+
# 2. We replace the expensive Conv2D by a Separable DW Conv.
494494
if use_cpe:
495495
self.conv_cpe_dw = create_conv2d(
496496
in_chs, in_chs,

timm/models/_features.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def feature_take_indices(
3232
) -> Tuple[List[int], int]:
3333
""" Determine the absolute feature indices to 'take' from.
3434
35-
Note: This function can be called in forwar() so must be torchscript compatible,
35+
Note: This function can be called in forward() so must be torchscript compatible,
3636
which requires some incomplete typing and workaround hacks.
3737
3838
Args:

timm/models/byobnet.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def _get_kernel_bias(self) -> Tuple[torch.Tensor, torch.Tensor]:
611611
return kernel_final, bias_final
612612

613613
def _fuse_bn_tensor(self, branch) -> Tuple[torch.Tensor, torch.Tensor]:
614-
""" Method to fuse batchnorm layer with preceeding conv layer.
614+
""" Method to fuse batchnorm layer with preceding conv layer.
615615
Reference: https://github.com/DingXiaoH/RepVGG/blob/main/repvgg.py#L95
616616
"""
617617
if isinstance(branch, ConvNormAct):
@@ -800,7 +800,7 @@ def _get_kernel_bias(self) -> Tuple[torch.Tensor, torch.Tensor]:
800800
return kernel_final, bias_final
801801

802802
def _fuse_bn_tensor(self, branch) -> Tuple[torch.Tensor, torch.Tensor]:
803-
""" Method to fuse batchnorm layer with preceeding conv layer.
803+
""" Method to fuse batchnorm layer with preceding conv layer.
804804
Reference: https://github.com/DingXiaoH/RepVGG/blob/main/repvgg.py#L95
805805
"""
806806
if isinstance(branch, ConvNormAct):

timm/models/crossvit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
"""
24-
Modifed from Timm. https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vision_transformer.py
24+
Modified from Timm. https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vision_transformer.py
2525
2626
"""
2727
from functools import partial

timm/models/efficientvit_msra.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def __init__(
246246
def forward(self, x):
247247
H = W = self.resolution
248248
B, C, H_, W_ = x.shape
249-
# Only check this for classifcation models
249+
# Only check this for classification models
250250
_assert(H == H_, f'input feature has wrong size, expect {(H, W)}, got {(H_, W_)}')
251251
_assert(W == W_, f'input feature has wrong size, expect {(H, W)}, got {(H_, W_)}')
252252
if H <= self.window_resolution and W <= self.window_resolution:

timm/models/fastvit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def _get_kernel_bias(self) -> Tuple[torch.Tensor, torch.Tensor]:
231231
def _fuse_bn_tensor(
232232
self, branch: Union[nn.Sequential, nn.BatchNorm2d]
233233
) -> Tuple[torch.Tensor, torch.Tensor]:
234-
"""Method to fuse batchnorm layer with preceeding conv layer.
234+
"""Method to fuse batchnorm layer with preceding conv layer.
235235
Reference: https://github.com/DingXiaoH/RepVGG/blob/main/repvgg.py#L95
236236
237237
Args:

timm/models/focalnet.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def forward(self, x):
7878
x = self.f(x)
7979
q, ctx, gates = torch.split(x, self.input_split, 1)
8080

81-
# context aggreation
81+
# context aggregation
8282
ctx_all = 0
8383
for l, focal_layer in enumerate(self.focal_layers):
8484
ctx = focal_layer(ctx)
@@ -353,7 +353,7 @@ def __init__(
353353
focal_levels: How many focal levels at all stages. Note that this excludes the finest-grain level.
354354
focal_windows: The focal window size at all stages.
355355
use_overlap_down: Whether to use convolutional embedding.
356-
use_post_norm: Whether to use layernorm after modulation (it helps stablize training of large models)
356+
use_post_norm: Whether to use layernorm after modulation (it helps stabilize training of large models)
357357
layerscale_value: Value for layer scale.
358358
drop_rate: Dropout rate.
359359
drop_path_rate: Stochastic depth rate.

0 commit comments

Comments
 (0)