IBM / transition-amr-parser

SoTA Abstract Meaning Representation (AMR) parsing with word-node alignments in Pytorch. Includes checkpoints and other tools such as statistical significance Smatch.
Apache License 2.0
231 stars 46 forks source link

src_fixed_embeddings.sizes. AttributeError: 'NoneType' object has no attribute 'sizes' #6

Closed LiuChen888 closed 3 years ago

LiuChen888 commented 3 years ago

I was just trying to train a simple model on the PTB and I got the following error. Could you tell me what's wrong? Thanks in advance.

stage-1: Preprocess stage-2/3: Training/Testing (multiple seeds) Saved fairseq model args to DATA/dep-parsing/models/PTB_RoBERTa-base_stnp6x6-seed42/config.json fairseq-train DATA/dep-parsing/features/PTB_RoBERTa-base --max-epoch 80 --arch stack_transformer_6x6_nopos --optimizer adam --adam-betas '(0.9,0.98)' --clip-norm 0.0 --lr-scheduler inverse_sqrt --warmup-init-lr 1e-07 --warmup-updates 4000 --pretrained-embed-dim 768 --lr 0.0005 --min-lr 1e-09 --dropout 0.3 --weight-decay 0.0 --criterion label_smoothed_cross_entropy --label-smoothing 0.01 --keep-last-epochs 40 --max-tokens 3584 --log-format json --fp16 --seed 42 --save-dir DATA/dep-parsing/models/PTB_RoBERTa-base_stnp6x6-seed42 CUDA? True | distributed init (rank 1): tcp://localhost:10159 CUDA? True | distributed init (rank 0): tcp://localhost:10159 | initialized host flash as rank 1 | initialized host flash as rank 0 Namespace(activation_dropout=0.0, activation_fn='relu', adam_betas="'(0.9,0.98)'", adam_eps=1e-08, adaptive_input=False, adaptive_softmax_cutoff=None, adaptive_softmax_dropout=0, arch='stack_transformer_6x6_nopos', attention_dropout=0.0, bert_backprop=False, best_checkpoint_metric='loss', bpe=None, bucket_cap_mb=25, burnthrough=0, clip_norm=0.0, cpu=False, criterion='label_smoothed_cross_entropy', curriculum=0, data='DATA/dep-parsing/features/PTB_RoBERTa-base', dataset_impl=None, ddp_backend='c10d', decoder_attention_heads=4, decoder_embed_dim=256, decoder_embed_path=None, decoder_ffn_embed_dim=512, decoder_input_dim=256, decoder_layers=6, decoder_learned_pos=False, decoder_normalize_before=False, decoder_output_dim=256, device_id=0, disable_validation=False, distributed_backend='nccl', distributed_init_method='tcp://localhost:10159', distributed_no_spawn=False, distributed_port=-1, distributed_rank=0, distributed_world_size=2, dropout=0.3, encode_state_machine='all-layers_nopos', encoder_attention_heads=4, encoder_embed_dim=256, encoder_embed_path=None, encoder_ffn_embed_dim=512, encoder_layers=6, encoder_learned_pos=False, encoder_normalize_before=False, find_unused_parameters=False, fix_batches_to_gpus=False, fp16=True, fp16_init_scale=128, fp16_scale_tolerance=0.0, fp16_scale_window=None, keep_interval_updates=-1, keep_last_epochs=40, label_smoothing=0.01, lazy_load=False, left_pad_source='True', left_pad_target='False', log_format='json', log_interval=1000, lr=[0.0005], lr_scheduler='inverse_sqrt', max_epoch=80, max_sentences=None, max_sentences_valid=None, max_source_positions=1024, max_target_positions=1024, max_tokens=3584, max_tokens_valid=3584, max_update=0, maximize_best_checkpoint_metric=False, memory_efficient_fp16=False, min_loss_scale=0.0001, min_lr=1e-09, no_bert_precompute=False, no_epoch_checkpoints=False, no_last_checkpoints=False, no_progress_bar=False, no_save=False, no_save_optimizer_state=False, no_token_positional_embeddings=False, num_workers=1, optimizer='adam', optimizer_overrides='{}', pretrained_embed_dim=768, raw_text=False, required_batch_size_multiple=8, reset_dataloader=False, reset_lr_scheduler=False, reset_meters=False, reset_optimizer=False, restore_file='checkpoint_last.pt', save_dir='DATA/dep-parsing/models/PTB_RoBERTa-base_stnp6x6-seed42', save_interval=1, save_interval_updates=0, seed=42, sentence_avg=False, share_all_embeddings=False, share_decoder_input_output_embed=False, skip_invalid_size_inputs_valid_test=False, source_lang=None, target_lang=None, task='translation', tbmf_wrapper=False, tensorboard_logdir='', threshold_loss_scale=None, tokenizer=None, train_subset='train', update_freq=[1], upsample_primary=1, use_bmuf=False, user_dir=None, valid_subset='valid', validate_interval=1, warmup_init_lr=1e-07, warmup_updates=4000, weight_decay=0.0) | [en] dictionary: 45272 types | [actions] dictionary: 88 types | loaded 1700 examples from: DATA/dep-parsing/features/PTB_RoBERTa-base/valid.en-actions.en | loaded 1700 examples from: DATA/dep-parsing/features/PTB_RoBERTa-base/valid.en-actions.actions | DATA/dep-parsing/features/PTB_RoBERTa-base valid en-actions 1700 examples Traceback (most recent call last): File "/home/liu/anaconda3/envs/seq2seq/bin/fairseq-train", line 33, in sys.exit(load_entry_point('fairseq', 'console_scripts', 'fairseq-train')()) File "/home/liu/transition-amr-parser-0.3.3/fairseq-stack-transformer/fairseq_cli/train.py", line 335, in cli_main nprocs=args.distributed_world_size, File "/home/liu/anaconda3/envs/seq2seq/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 167, in spawn while not spawn_context.join(): File "/home/liu/anaconda3/envs/seq2seq/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 114, in join raise Exception(msg) Exception:

-- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/liu/anaconda3/envs/seq2seq/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, *args) File "/home/liu/transition-amr-parser-0.3.3/fairseq-stack-transformer/fairseq_cli/train.py", line 302, in distributed_main main(args, init_distributed=True) File "/home/liu/transition-amr-parser-0.3.3/fairseq-stack-transformer/fairseq_cli/train.py", line 47, in main task.load_dataset(valid_sub_split, combine=False, epoch=0) File "/home/liu/transition-amr-parser-0.3.3/fairseq-stack-transformer/fairseq/tasks/translation.py", line 251, in load_dataset state_machine=state_machine File "/home/liu/transition-amr-parser-0.3.3/fairseq-stack-transformer/fairseq/tasks/translation.py", line 126, in load_langpair_dataset src_fixed_embeddings, src_fixed_embeddings.sizes, AttributeError: 'NoneType' object has no attribute 'sizes'

ramon-astudillo commented 3 years ago

This looks like the reading of the data failed. In that case the class is None and you get that error. Have you checked if the data is there?. You can always put a breakpoint before that line an check the paths that it tries to read to check.

LiuChen888 commented 3 years ago

As far as I know, code in file "fairseq-stack-transformer/fairseq/tasks/translation.py" is trying to read RoBERTa embeddings from file "DATA/dep-parsing/features/PTB_RoBERTa-base/valid.en-actions.en.bert" that doesn't exist. Should I provide this data? If so, how did you generated it? Thanks.

ramon-astudillo commented 3 years ago

That should be generated on the fly, what you may be missing is the dependency parsing oracle and PTB data (which we can not provide as it is proprietary). As indicated in the paper, we followed https://arxiv.org/abs/1505.08075 to generate this from of the official PTB data.

LiuChen888 commented 3 years ago

Yes, I have included oracle actions and it seems that words and actions dictionaries were correctly created (as you can see from the output posted above); however, the generation of RoBERTa embeddings is not properly working. Maybe I did something wrong. I will check it. Thanks anyways.