Open zouharvi opened 2 years ago
Same thing happens when I try to load it locally:
from fairseq.models.fconv import FConvModel
model = FConvModel.from_pretrained(
"/home/vilda/Downloads/wmt14.en-de.fconv-py/",
checkpoint_file="model.pt",
bpe="subword_nmt",
bpe_codes="bpecodes"
)
Output:
2022-08-31 14:01:24 | INFO | fairseq.file_utils | loading archive file /home/vilda/Downloads/wmt14.en-de.fconv-py/
2022-08-31 14:01:26 | INFO | fairseq.tasks.translation | [en] dictionary: 42243 types
2022-08-31 14:01:26 | INFO | fairseq.tasks.translation | [de] dictionary: 43676 types
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/vilda/.local/lib/python3.10/site-packages/fairseq/models/fairseq_model.py", line 267, in from_pretrained
x = hub_utils.from_pretrained(
File "/home/vilda/.local/lib/python3.10/site-packages/fairseq/hub_utils.py", line 82, in from_pretrained
models, args, task = checkpoint_utils.load_model_ensemble_and_task(
File "/home/vilda/.local/lib/python3.10/site-packages/fairseq/checkpoint_utils.py", line 482, in load_model_ensemble_and_task
model.load_state_dict(
File "/home/vilda/.local/lib/python3.10/site-packages/fairseq/models/fairseq_model.py", line 128, in load_state_dict
return super().load_state_dict(new_state_dict, strict)
File "/home/vilda/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1604, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for FConvModel:
Missing key(s) in state_dict: "decoder.version".
size mismatch for decoder.convolutions.0.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.1.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.2.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.3.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.4.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.5.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.6.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.7.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.8.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
size mismatch for decoder.convolutions.9.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 2048]).
size mismatch for decoder.convolutions.10.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 2048]).
size mismatch for decoder.convolutions.11.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 2048]).
size mismatch for decoder.convolutions.12.weight_g: copying a param with shape torch.Size([3, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 2048]).
size mismatch for decoder.convolutions.13.weight_g: copying a param with shape torch.Size([1, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 4096]).
size mismatch for decoder.convolutions.14.weight_g: copying a param with shape torch.Size([1, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1, 4096]).
Loading conv.wmt17.en-de
works without any issues.
🐛 Bug
Loading
conv.wmt14.en-de
from the hub fails despite being listed in available pre-trained models.To Reproduce
Resulting output:
Environment