Error in Chinese Abstractive summarization preprocessing

Hello! I was trying to use Chinese Abstractive summarization model from Report for Chinese Abstractive summarization performance · Issue #547 · OpenNMT/OpenNMT-py · GitHub on colab with the next steps:

  • created config.yaml
  • ran onmt_build_vocab on my dataset
  • executed onmt_translate with pretrained chinese model on my dataset
    but encountered this error:
Traceback (most recent call last):
  File "/usr/local/bin/onmt_translate", line 8, in <module>
  File "/usr/local/lib/python3.7/dist-packages/onmt/bin/", line 44, in main
  File "/usr/local/lib/python3.7/dist-packages/onmt/bin/", line 15, in translate
    translator = build_translator(opt, logger=logger, report_score=True)
  File "/usr/local/lib/python3.7/dist-packages/onmt/translate/", line 32, in build_translator
    fields, model, model_opt = load_test_model(opt)
  File "/usr/local/lib/python3.7/dist-packages/onmt/", line 96, in load_test_model
  File "/usr/local/lib/python3.7/dist-packages/onmt/", line 238, in build_base_model
    model = build_task_specific_model(model_opt, fields)
  File "/usr/local/lib/python3.7/dist-packages/onmt/", line 150, in build_task_specific_model
    encoder, src_emb = build_encoder_with_embeddings(model_opt, fields)
  File "/usr/local/lib/python3.7/dist-packages/onmt/", line 121, in build_encoder_with_embeddings
    src_emb = build_src_emb(model_opt, fields)
  File "/usr/local/lib/python3.7/dist-packages/onmt/", line 112, in build_src_emb
    src_field = fields["src"]
TypeError: list indices must be integers or slices, not str

Could you, please, tell me, which steps did I miss?

The checkpoint’s vocab is not compatible with the latest releases.
You can fix it with something like this:

Thank you for your reply! Checking out revision 585499a450 from provided link helped with loading model’s vocab.