Closed ljj7975 closed 4 years ago
The XLMRModel.from_pretrained
version should work in PyTorch 1.3 as well. Did you try it?
yes, I was getting following error so I thought it was no longer supported
>>> from fairseq.models.roberta import XLMRModel
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'XLMRModel' from 'fairseq.models.roberta' (/home/xxx/anaconda3/envs/xxx/lib/python3.7/site-packages/fairseq/models/roberta/__init__.py)
Ah, did you install fairseq via pip? The pip package is quite outdated so doesn't have XLMRModel in it yet.
You need to instead clone fairseq and pip install --editable .
. See "Installing from source" here: https://github.com/pytorch/fairseq#requirements-and-installation
confirmed it works. Thanks!
Is there any way to load
XLMRModel
class from fairseq with Pytorch 1.3?I cannot use
torch.hub.load
because I do not have any internet connection In order to bypass the downloading, I have the model on local but I cannot figure out how I can initialize the model and load the model.pt.For PyTorch 1.0, the example in the repo has
but it seems like it is no longer availble for PyTorch 1.3
Can anyone help me? Thanks