[Bug][Conversion Tools] mxnet block.py Overriding Parameter attribute %s is not allowed
makua-bernal opened this issue · comments
Makua Bernal commented
Description
When using the conversion tools to convert a roberta model the following error occurs.
Error Message
Traceback (most recent call last):
File "convert_fairseq_roberta.py", line 386, in <module>
convert_fairseq_model(args)
File "convert_fairseq_roberta.py", line 355, in convert_fairseq_model
gluon_roberta = convert_params(fairseq_roberta,
File "convert_fairseq_roberta.py", line 174, in convert_params
gluon_model = RobertaForMLM(backbone_cfg=gluon_cfg)
File "/home/user/.local/lib/python3.8/site-packages/mxnet/util.py", line 297, in _with_np_shape
return func(*args, **kwargs)
File "/home/user/.local/lib/python3.8/site-packages/mxnet/util.py", line 481, in _with_np_array
return func(*args, **kwargs)
File "/home/user/gluon-nlp/src/gluonnlp/models/roberta.py", line 484, in __init__
self.mlm_decoder[-1].weight = self.backbone_model.word_embed.weight
File "/home/user/.local/lib/python3.8/site-packages/mxnet/gluon/block.py", line 886, in __setattr__
super(HybridBlock, self).__setattr__(name, value)
File "/home/user/.local/lib/python3.8/site-packages/mxnet/gluon/block.py", line 305, in __setattr__
assert name not in self._reg_params, \
AssertionError: Overriding Parameter attribute %s is not allowed. If you want to share parameters between blocks, please set 'params' at Block construction instead.
To Reproduce
gluonnlp version 1.0.0.dev20210116
mxnet version 1.7.0.post1
fairseq version 1.0.0a0+4a6f89d
bash convert_roberta.sh
Xingjian Shi commented
@jumpily You may need to install MXNet 2.0 and try again. You can try out the following commands:
# Install the version with CUDA 10.1
python3 -m pip install -U --pre "mxnet-cu101>=2.0.0b20201206" -f https://dist.mxnet.io/python
# Install the version with CUDA 10.2
python3 -m pip install -U --pre "mxnet-cu102>=2.0.0b20201206" -f https://dist.mxnet.io/python
# Install the version with CUDA 11
python3 -m pip install -U --pre "mxnet-cu110>=2.0.0b20201206" -f https://dist.mxnet.io/python
# Install the cpu-only version
python3 -m pip install -U --pre "mxnet>=2.0.0b20201206" -f https://dist.mxnet.io/python
Makua Bernal commented
@sxjscience That seems to have worked, thank you! Are the converted models compatible with lower MXNet versions?
Xingjian Shi commented
No, they are not.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: jumpily <notifications@github.com>
Sent: Sunday, January 17, 2021 1:38:44 AM
To: dmlc/gluon-nlp <gluon-nlp@noreply.github.com>
Cc: Xingjian SHI <xshiab@connect.ust.hk>; Mention <mention@noreply.github.com>
Subject: Re: [dmlc/gluon-nlp] [Bug][Conversion Tools] mxnet block.py Overriding Parameter attribute %s is not allowed (#1485)
@sxjscience<https://github.com/sxjscience> That seems to have worked, thank you! Are the converted models compatible with lower MXNet versions?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#1485 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHQH3SYL3RFSBWLVFBF33LS2KV2JANCNFSM4WFI5EZA>.
Xingjian Shi commented
@jumpily i’ll close this issue since it has been solved. Feel free to reopen.