You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -96,21 +96,21 @@ As we can see the new API eliminates the aforementioned limitations. Let’s exp
96
96
97
97
### Multi-weight support
98
98
99
-
At the heart of the new API, we have the ability to define multiple different weights for the same model variant. Each model building method (eg `resnet50`) has an associated Enum class (eg `ResNet50_Weights`) which has as many entries as the number of pre-trained weights available. Additionally, each Enum class has a `default` alias which points to the best available weights for the specific model. This allows the users who want to always use the best available weights to do so without modifying their code.
99
+
At the heart of the new API, we have the ability to define multiple different weights for the same model variant. Each model building method (eg `resnet50`) has an associated Enum class (eg `ResNet50_Weights`) which has as many entries as the number of pre-trained weights available. Additionally, each Enum class has a `DEFAULT` alias which points to the best available weights for the specific model. This allows the users who want to always use the best available weights to do so without modifying their code.
100
100
101
101
Here is an example of initializing models with different weights:
102
102
103
103
```python
104
104
from torchvision.prototype.models import resnet50, ResNet50_Weights
105
105
106
106
# Legacy weights with accuracy 76.130%
107
-
model = resnet50(weights=ResNet50_Weights.ImageNet1K_V1)
107
+
model = resnet50(weights=ResNet50_Weights.IMAGENET1K_V1)
108
108
109
-
# New weights with accuracy 80.674%
110
-
model = resnet50(weights=ResNet50_Weights.ImageNet1K_V2)
109
+
# New weights with accuracy 80.858%
110
+
model = resnet50(weights=ResNet50_Weights.IMAGENET1K_V2)
111
111
112
-
# Best available weights (currently alias for ImageNet1K_V2)
113
-
model = resnet50(weights=ResNet50_Weights.default)
112
+
# Best available weights (currently alias for IMAGENET1K_V2)
113
+
model = resnet50(weights=ResNet50_Weights.DEFAULT)
114
114
115
115
# No weights - random initialization
116
116
model = resnet50(weights=None)
@@ -124,10 +124,10 @@ The weights of each model are associated with meta-data. The type of information
124
124
from torchvision.prototype.models import ResNet50_Weights
@@ -172,8 +172,8 @@ In the new API the boolean `pretrained` and `pretrained_backbone` parameters, wh
172
172
UserWarning: The parameter 'pretrained'is deprecated, please use 'weights' instead.
173
173
UserWarning:
174
174
Arguments other than a weight enum or`None`for'weights' are deprecated.
175
-
The current behavior is equivalent to passing `weights=ResNet50_Weights.ImageNet1K_V1`.
176
-
You can also use `weights=ResNet50_Weights.default` to get the most up-to-date weights.
175
+
The current behavior is equivalent to passing `weights=ResNet50_Weights.IMAGENET1K_V1`.
176
+
You can also use `weights=ResNet50_Weights.DEFAULT` to get the most up-to-date weights.
177
177
```
178
178
179
179
Additionally the builder methods require using keyword parameters. The use of positional parameter is deprecated and using them emits the following warning:
@@ -191,7 +191,7 @@ Migrating to the new API is very straightforward. The following method calls bet
0 commit comments