Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multilingual.yml中的mask_path #8

Open
vicky-zhuang opened this issue Jul 26, 2022 · 8 comments
Open

multilingual.yml中的mask_path #8

vicky-zhuang opened this issue Jul 26, 2022 · 8 comments

Comments

@vicky-zhuang
Copy link

请问这里en2de和de2en的两个pt文件是Obtain the masks这一步得到的吗?我这边每个语言对只得到了一个文件,要想得到两个文件需要怎么做?望解答,感谢~
image

@linzehui
Copy link
Contributor

@vicky-zhuang 分别训en2de de2en模型然后分别获得mask

@vicky-zhuang
Copy link
Author

vicky-zhuang commented Jul 29, 2022

您好,我这边在每个语言方向上面finetune之后分别得到了mask的文件,但是在进行Training with masks出现了KeyError,经过检查发现sample中确实没有src_lang这个键值,麻烦您帮忙看一下,谢谢~
报错提示如下:

Traceback (most recent call last):
  File "/home/notebook/code/personal/zyq_env/bin/fairseq-train", line 33, in <module>
    sys.exit(load_entry_point('fairseq', 'console_scripts', 'fairseq-train')())
  File "/home/notebook/code/personal/fairseq/fairseq_cli/train.py", line 530, in cli_main
    distributed_utils.call_main(cfg, main)
  File "/home/notebook/code/personal/fairseq/fairseq/distributed/utils.py", line 369, in call_main
    main(cfg, **kwargs)
  File "/home/notebook/code/personal/fairseq/fairseq_cli/train.py", line 190, in main
    valid_losses, should_stop = train(cfg, trainer, task, epoch_itr)
  File "/home/notebook/code/personal/zyq_env/lib/python3.7/contextlib.py", line 74, in inner
    return func(*args, **kwds)
  File "/home/notebook/code/personal/fairseq/fairseq_cli/train.py", line 305, in train
    log_output = trainer.train_step(samples)
  File "/home/notebook/code/personal/zyq_env/lib/python3.7/contextlib.py", line 74, in inner
    return func(*args, **kwds)
  File "/home/notebook/code/personal/fairseq/fairseq/trainer.py", line 830, in train_step
    **extra_kwargs,
  File "/home/notebook/code/personal/LaSS/fairseq_code/tasks/mask_translation_multi_simple_epoch.py", line 33, in train_step
    src_lang = sample['src_lang']
KeyError: 'src_lang'

检查如下

image

sample type:<class 'dict'>
sample keys:dict_keys(['id', 'nsentences', 'ntokens', 'net_input', 'target'])
sample["net_input"]:dict_keys(['src_tokens', 'src_lengths', 'prev_output_tokens'])

@linzehui
Copy link
Contributor

可能是版本问题。你如果用的是最新版fairseq来训multilingual和fine-tune模型,是有可能出现key对不上的情况的

@vicky-zhuang
Copy link
Author

请问你们的fairseq版本是多少?除了更换版本之外还有什么其他的解决办法吗?

@linzehui
Copy link
Contributor

版本参考 https://github.com/NLP-Playground/LaSS/blob/master/scripts/install.sh
你也可以自己改一下现有代码适配新的fairseq,这里主要是新老版本fairseq的key对不上

@vicky-zhuang
Copy link
Author

好的,谢谢,我试一下

@vicky-zhuang
Copy link
Author

我用了上面脚本的命令尝试安装旧版本的fairseq但是出现了error,请问您具体用的是哪个版本的fairseq呢?

@linzehui
Copy link
Contributor

@vicky-zhuang 不记得了,用git checkout到具体版本即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants