dbiir / UER-py

Open Source Pre-training Model Framework in PyTorch & Pre-trained Model Zoo
https://github.com/dbiir/UER-py/wiki
Apache License 2.0
3k stars 528 forks source link

AttributeError: 'Namespace' object has no attribute 'stream_0' #327

Open yuanfengning opened 2 years ago

yuanfengning commented 2 years ago

通过下面命令对孪生网络进行微调时,报错。 python finetune/run_classifier_siamese.py --pretrained_model_path chinese_roberta/pytorch_model.bin --vocab_path chinese_roberta/vocab.txt --config_path chinese_roberta/config.json --train_path datasets/ChineseTextualInference/train.tsv --dev_path datasets/ChineseTextualInference/dev.tsv --learning_rate 5e-5 --epochs_num 2 --batch_size 64

错误如下:

Traceback (most recent call last):
  File "finetune/run_classifier_siamese.py", line 337, in <module>
    main()
  File "finetune/run_classifier_siamese.py", line 265, in main
    model = SiameseClassifier(args)
  File "finetune/run_classifier_siamese.py", line 34, in __init__
    self.embedding = DualEmbedding(args, len(args.tokenizer.vocab))
  File "/general-user/ai/uer/UER-py-master/uer/embeddings/dual_embedding.py", line 14, in __init__
    stream_0_args.update(args.stream_0)
AttributeError: 'Namespace' object has no attribute 'stream_0'

用的是master分支,环境标量按照readme进行的配置。 麻烦解答下, 谢谢!!!

ydli-ai commented 2 years ago

配置文件换成 sbert/base_config.json

yuanfengning commented 2 years ago

配置文件换成 sbert/base_config.json 谢谢,确实是配置文件导致的。

yuanfengning commented 2 years ago

配置文件换成 sbert/base_config.json

你好, 我用上面的命令做训练,交叉熵损失一直在0.5以上,模型不收敛。 预训练模型是:chinese_roberta_L-12_H-768 训练和测试数据为ChineseTextualInference提供的数据。 python finetune/run_classifier_siamese.py --pretrained_model_path chinese_roberta/pytorch_model.bin --vocab_path chinese_roberta/vocab.txt --config_path chinese_roberta/config.json --train_path datasets/ChineseTextualInference/train.tsv --dev_path datasets/ChineseTextualInference/dev.tsv --learning_rate 5e-5 --epochs_num 2 --batch_size 64 所有配置参数都是官网提供的。