ShuyangCao / cliff_summ

Code for EMNLP 2021 paper "CLIFF: Contrastive Learning for Improving Faithfulness and Factuality in Abstractive Summarization"
Apache License 2.0
45 stars 8 forks source link

Empty files when decoding #12

Open ashleylew opened 2 years ago

ashleylew commented 2 years ago

When using the decode_cnn.sh script (on my own dataset), the script finishes running, but the output files (bpe-test.txt and formatted-test.txt) are both empty. When I check the log file, I get this error:

Traceback (most recent call last):
  File "/home/lewis.2799/miniconda3/envs/QP2/bin/fairseq-generate", line 33, in <module>
    sys.exit(load_entry_point('fairseq', 'console_scripts', 'fairseq-generate')())
  File "/home/lewis.2799/fairseq/fairseq_cli/generate.py", line 392, in cli_main
    main(args)
  File "/home/lewis.2799/fairseq/fairseq_cli/generate.py", line 48, in main
    return _main(cfg, h)
  File "/home/lewis.2799/fairseq/fairseq_cli/generate.py", line 97, in _main
    models, saved_cfg = checkpoint_utils.load_model_ensemble(
  File "/home/lewis.2799/fairseq/fairseq/checkpoint_utils.py", line 262, in load_model_ensemble
    ensemble, args, _task = load_model_ensemble_and_task(
  File "/home/lewis.2799/fairseq/fairseq/checkpoint_utils.py", line 320, in load_model_ensemble_and_task
    model.load_state_dict(state["model"], strict=strict, model_cfg=cfg.model)
  File "/home/lewis.2799/fairseq/fairseq/models/fairseq_model.py", line 113, in load_state_dict
    self.upgrade_state_dict(state_dict)
  File "/home/lewis.2799/fairseq/fairseq/models/fairseq_model.py", line 119, in upgrade_state_dict
    self.upgrade_state_dict_named(state_dict, "")
  File "/home/lewis.2799/fairseq/fairseq/models/bart/model.py", line 185, in upgrade_state_dict_named
    num_classes = state_dict[
KeyError: 'classification_heads.contrast.out_proj.weight'

This appears to be related to the error described in this issue (not the initial post but a few comments down), but the author said that this error shouldn't be a problem.

I also printed the keys of the state_dict dictionary and several that are similar to the error key, though somewhat different:

classification_heads.contrast.dense.weight
classification_heads.contrast.dense.bias
classification_heads.contrast.out_proj.bias
classification_heads.contrast.out_proj.weight_orig
classification_heads.contrast.out_proj.weight_u
classification_heads.contrast.out_proj.weight_v

Wondering if there are any insights to why the generated files are empty? Thanks!!!

ShuyangCao commented 2 years ago

How long does it take for the script to finish running?

ashleylew commented 2 years ago

It finishes within about a minute.

ashleylew commented 2 years ago

I've been comparing my files with the ones provided to see if my formatting is the problem, and I'm slightly confused by the train.combine_target and val.combine_target files. The train file appears to be the raw text followed by the binarized version, but the val.combine_target appears to be the valid.target and the synthetic data val.raw_target combined. According to the command given on this page it seems that it should be the two raw files combined, right?

I don't think that's my main problem, but wanted to clarify!