Skip to content

Weibo Datase處理 #28

@elaine35002

Description

@elaine35002

作者您好,我想使用ZEN做embedding並提取相應的詞向量,因此執行了以下程式碼:

 python3 run_token_level_classification.py --data_dir data/weibo --bert_model models --task_name msra --do_train --do_ev
al --train_batch_size 32 --eval_batch_size 32 --learning_rate 2e-5 --num_train_epochs 3

但出現如下報錯:

raceback (most recent call last):
  File "run_token_level_classification.py", line 438, in <module>
    main()
  File "run_token_level_classification.py", line 425, in main
    model = ZenForTokenClassification.from_pretrained(args.bert_model,
  File "/home/code-server/SANER/ZEN/modeling.py", line 838, in from_pretrained
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ZenForTokenClassification:
        size mismatch for classifier.weight: copying a param with shape torch.Size([10, 768]) from checkpoint, the shape in current model is torch.Size([20, 768]).
        size mismatch for classifier.bias: copying a param with shape torch.Size([10]) from checkpoint, the shape in current model is torch.Size([20]).

請問可以怎麼解決呢?謝謝 我用的模型是下載的預訓練NER模型
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions