This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
DescriptionI want to use a pretrained model in the model zoo (such as BERT) as a layer in my own model. class Mymodel(nn.Block):
def __init__(bert_model):
self.bert = bert_model
.....
bert_model = get_model(....)
model = Mymodel(bert_model) But I have a small problem about the naming, since bert_model and other parameters in my own model didn't have a same prefix, which can cause error in model.save_params() |
Beta Was this translation helpful? Give feedback.
Answered by
zachgk
Sep 20, 2019
Replies: 1 comment
-
You should use Mymodel.name_scope() when defining the child blocks. Take a look at the documentation in http://beta.mxnet.io/api/gluon/mxnet.gluon.nn.Block.html. Also, use model.save_parameters as save_params is deprecated. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
szha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should use Mymodel.name_scope() when defining the child blocks. Take a look at the documentation in http://beta.mxnet.io/api/gluon/mxnet.gluon.nn.Block.html. Also, use model.save_parameters as save_params is deprecated.