thomelane commented on a change in pull request #15365: [TUTORIAL] Revise
Naming tutorial
URL: https://github.com/apache/incubator-mxnet/pull/15365#discussion_r297439373
##########
File path: docs/tutorials/gluon/naming.md
##########
@@ -217,45 +161,31 @@ except Exception as e:
print(e)
```
- Parameter 'model1_dense0_weight' is missing in file 'model.params', which
contains parameters: 'model0_mydense_weight', 'model0_dense1_bias',
'model0_dense1_weight', 'model0_dense0_weight', 'model0_dense0_bias',
'model0_mydense_bias'. Please make sure source and target networks have the
same prefix.
-
-
-To solve this problem, we use `save_parameters`/`load_parameters` instead of
`collect_params` and `save`/`load`. `save_parameters` uses model structure,
instead of parameter name, to match parameters.
-
+To solve this problem, we use `save_parameters`/`load_parameters` instead of
`collect_params` and `save`/`load`. The `save_parameters` method uses model
structure instead of parameter names to match parameters.
```python
model0.save_parameters('model.params')
model1.load_parameters('model.params')
print(mx.nd.load('model.params').keys())
```
- ['dense0.bias', 'mydense.bias', 'dense1.bias', 'dense1.weight',
'dense0.weight', 'mydense.weight']
-
-
-## Replacing Blocks from networks and fine-tuning
-
-Sometimes you may want to load a pretrained model, and replace certain Blocks
in it for fine-tuning.
-
-For example, the alexnet in model zoo has 1000 output dimensions, but maybe
you only have 100 classes in your application.
+## Replacing Blocks in networks and fine-tuning
-To see how to do this, we first load a pretrained AlexNet.
-
-- In Gluon model zoo, all image classification models follow the format where
the feature extraction layers are named `features` while the output layer is
named `output`.
-- Note that the output layer is a dense block with 1000 dimension outputs.
+Sometimes you may want to load a pretrained model, and replace certain Blocks
in it for fine-tuning. For example, the
[`AlexNet`](https://mxnet.incubator.apache.org/versions/master/api/python/gluon/model_zoo.html#vision)
model in the model zoo has 1000 output dimensions, but maybe you have only 100
classes in your application. Let's see how to change the number of output
dimensions from 1000 to 100.
Review comment:
Would mention that you can just set `classes` argument for this case. Guess
you're doing like this for demonstration purposes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services