add import_ for SymbolBlock#11127
Conversation
| prefix='resnet', ctx=ctx, pretrained=True) | ||
| model.hybridize() | ||
| data = mx.nd.random.normal(shape=(1, 3, 224, 224)) | ||
| data = mx.nd.random.normal(shape=(1, 3, 32, 32)) |
There was a problem hiding this comment.
any specific reason for this change?
| >>> print(feat_model(x)) | ||
| """ | ||
| @staticmethod | ||
| def import_(symbol_file, input_names, param_file=None, ctx=None): |
There was a problem hiding this comment.
I don't think import_ is a great name, even though I understand that we want to be as close as possible to .export and import being a key-word makes it impossible to use .import().
I would suggest adding an alias to export, export_symbols export_to_symbol export_hybridized, etc and have the matching one for import. That way it would be clearer, as adding a _ suffix is not a conventionnal thing to do and is close to the use of _ as a prefix, which is for private functions.
ThomasDelteil
left a comment
There was a problem hiding this comment.
I think imports is a good compromise in terms of naming 👍
szha
left a comment
There was a problem hiding this comment.
I don't believe the save_params change is a step in the right direction.
| present in this Block. | ||
| """ | ||
| warnings.warn("load_params is deprecated. Please use load_parameters.") | ||
| import pdb;pdb.set_trace() |
There was a problem hiding this comment.
remove these pdb statements here and elsewhere ?
|
Can you please update the tutorial here: https://github.com/apache/incubator-mxnet/blob/master/docs/tutorials/gluon/save_load_params.md to show the new simpler usage of Just read the tutorial and noticed a few things that are wrong because of how it was iteratively updated: |
| Path to file. | ||
| """ | ||
| warnings.warn("save_params is deprecated. Please use save_parameters.") | ||
| self.collect_params().save(filename, strip_prefix=self.prefix) |
There was a problem hiding this comment.
let's not make this change to the save_params.
| filename : str | ||
| Path to file. | ||
| """ | ||
| warnings.warn("save_params is deprecated. Please use save_parameters.") |
There was a problem hiding this comment.
shall we add something about export? Something like "If you are using an hybridized model and want to serialize it to obtain the network structure and parameters, please refer to HybridBlock.export()"
|
Wasn't the final decision to provide deprecation warning for |
|
@anirudh2290, no, such change would break users who are on 1.2.0. |
| @@ -61,7 +61,7 @@ def build_lenet(net): | |||
| net.add(gluon.nn.Dense(512, activation="relu")) | |||
There was a problem hiding this comment.
L13 there is also "load_checkpoint and load methods" -> "imports method
There was a problem hiding this comment.
we can make this change as part of another PR to avoid another round of CI.
There was a problem hiding this comment.
sorry didnt realize this was already in.
* add import_ for SymbolBlock * fix * Update block.py * add save_parameters * fix * fix lint * fix * fix * fix * fix * fix * Update save_load_params.md
* add import_ for SymbolBlock * fix * Update block.py * add save_parameters * fix * fix lint * fix * fix * fix * fix * fix * Update save_load_params.md
Description
(Brief description on what this PR is about)
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments