Closed TinaChen95 closed 1 year ago
I tried to use the default code sample, but it didn't work
The error message is as follows: fairseq/fairseq/data/min_phoneme_mask_tokens_dataset.py new item[mask pure] = spitem[torch.from numpy(mask pure.astype(np.uint8)) = 1] IndexError: The shape of the mask [197] at index 0 does not match the shape of the indexed tensor [195] at index 0
sorry for reply late. I tried with the demo data and didn`t get this error. I am trying to know why. Maybe you can provide more information about this error ?
[2023-07-04 13:14:08,048][fairseq.trainer][INFO] - begin training epoch 1 [2023-07-04 13:14:08,049][fairseq_cli.train][INFO] - Start iterating over samples [2023-07-04 13:14:11,538][fairseq.trainer][INFO] - NOTE: gradient overflow detected, ignoring gradient, setting loss scale to: 64.0 [2023-07-04 13:14:12,735][fairseq_cli.train][INFO] - begin validation on "valid" subset [2023-07-04 13:14:12,737][fairseq.tasks.fairseq_task][INFO] - can_reuse_epoch_itr = True [2023-07-04 13:14:12,812][fairseq.logging.progress_bar][WARNING] - tensorboard not found, please install with: pip install tensorboard [2023-07-04 13:14:13,026][valid][INFO] - {"epoch": 1, "valid_loss": "7.42", "valid_loss_p": "7.747", "valid_loss_sp": "7.092", "valid_acc_phoneme": "0.006", "valid_acc_sup_phoneme": "0.003", "valid_ppl": "171.23", "valid_wps": "295936", "valid_wpb": "6633", "valid_bsz": "13.3", "valid_num_updates": "2"} [2023-07-04 13:14:13,028][fairseq.checkpoint_utils][INFO] - Preparing to save checkpoint for epoch 1 @ 2 updates [2023-07-04 13:14:13,029][fairseq.trainer][INFO] - Saving checkpoint to /home/u1190303311/mix-phoneme-bert-main/data/multirun/2023-07-04/13-14-03/0/checkpoints/checkpoint_best.pt [2023-07-04 13:14:13,533][fairseq.trainer][INFO] - Finished saving checkpoint to /home/u1190303311/mix-phoneme-bert-main/data/multirun/2023-07-04/13-14-03/0/checkpoints/checkpoint_best.pt [2023-07-04 13:14:13,888][fairseq.checkpoint_utils][INFO] - Saved checkpoint checkpoints/checkpoint_best.pt (epoch 1 @ 2 updates, score 7.42) (writing took 0.8604913745075464 seconds) [2023-07-04 13:14:13,889][fairseq_cli.train][INFO] - end of epoch 1 (average epoch stats below) [2023-07-04 13:14:13,890][train][INFO] - {"epoch": 1, "train_loss": "7.397", "train_loss_p": "7.756", "train_loss_sp": "7.038", "train_acc_phoneme": "0.008", "train_acc_sup_phoneme": "0.001", "train_ppl": "168.53", "train_wps": "29420.1", "train_ups": "0.66", "train_wpb": "53981", "train_bsz": "108", "train_num_updates": "2", "train_lr": "1e-07", "train_gnorm": "1.057", "train_loss_scale": "64", "train_train_wall": "4", "train_gb_free": "38", "train_wall": "7"} [2023-07-04 13:14:13,893][fairseq.tasks.fairseq_task][INFO] - can_reuse_epoch_itr = True [2023-07-04 13:14:13,967][fairseq.data.iterators][INFO] - grouped total_num_itrs = 3
Thanks for your reply !
I reacquired the code, move all code to /home/wangzhijun2/mix-phoneme-bert/ and installed fairseq in this repo. When I run bash train.sh, the program reports this error:
''' omegaconf.errors.ConfigAttributeError: Key 'data' is not in struct full key: task.data reference type=Any object type-dict
hydra.errors.ConfigCompositionException: Could not override task.data To append to your config use +task.data=/home/wangzhijun2/mix-phoneme-bert/data/bpe/bin '''
Have you ever encountered this problem? What are the versions of hydra-core and omegaconf you use? Thanks!
Thanks for your reply !
I reacquired the code, move all code to /home/wangzhijun2/mix-phoneme-bert/ and installed fairseq in this repo. When I run bash train.sh, the program reports this error:
''' omegaconf.errors.ConfigAttributeError: Key 'data' is not in struct full key: task.data reference type=Any object type-dict
hydra.errors.ConfigCompositionException: Could not override task.data To append to your config use +task.data=/home/wangzhijun2/mix-phoneme-bert/data/bpe/bin '''
Have you ever encountered this problem? What are the versions of hydra-core and omegaconf you use? Thanks!
find base.yaml at fairseq/examples/roberta/config/pretraiing/,
add task.data attribute like this:
task: _name: mix_phoneme_masked_lm sample_break_mode: complete tokens_per_sample: 510 mask_whole_words: True data: /home/u1190303311/mix-phoneme-bert-main/fairseq/examples/roberta/config/pretraining
the path of data could be any str. this parameter can be changed at the train.sh. Thank you for your report of this problem, I will push a pr to fix it.
Thanks, it works!
I tried to use the default code sample, but it didn't work
The error message is as follows: fairseq/fairseq/data/min_phoneme_mask_tokens_dataset.py new item[mask pure] = spitem[torch.from numpy(mask pure.astype(np.uint8)) = 1] IndexError: The shape of the mask [197] at index 0 does not match the shape of the indexed tensor [195] at index 0