fairseq
fairseq copied to clipboard
omegaconf.errors.ValidationError: Cannot convert 'DictConfig' to string
Describe the bug when i used fairseq to load a pretrained model, an error occured:
omegaconf.errors.ValidationError: Cannot convert 'DictConfig' to string: '{'_name': 'gpt2', 'gpt2_encoder_json': 'https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/encoder.json', 'gpt2_vocab_bpe': 'https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/vocab.bpe'}' full_key: bpe object_type=DenoisingConfig
To Reproduce from fairseq.models.bart import BARTModel
d1_bart = BARTModel.from_pretrained( d1_path, checkpoint_file=args.d1_model_path.split("/")[-1], data_name_or_path=d1_data_bin, )
any success?
I've managed to fix it by using the TransformerModel instead of BARTModel if you still need a fix
from fairseq.models.transformer import TransformerModel
d2_bart = TransformerModel.from_pretrained(
d2_path,
checkpoint_file=args.d2_model_path.split("/")[-1],
data_name_or_path=d2_data_bin,
)