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

How to run the demo code? #76

Open
CopyNinja1999 opened this issue Mar 20, 2022 · 1 comment
Open

How to run the demo code? #76

CopyNinja1999 opened this issue Mar 20, 2022 · 1 comment

Comments

@CopyNinja1999
Copy link

Hi, I've downloaded the code and pretrained file as instructed in my Win10 system. My files under the path looks like:
data/ LICENSE pair-bert-train_wiki-val_wiki-5-1.pth.tar pretrain/ readme.md fewshot_re_kit/ models/ paper/ pretrain.tar train_demo.py
But when I am running the given demo command, it gives me such error:
`$ python train_demo.py --trainN 5 --N 5 --K 1 --Q 1 --model pair --encoder bert --pair --hidden_size 768 --val_step 1000 --batch_size 4 --fp16
5-way-1-shot Few-Shot Relation Classification
model: pair
encoder: bert
max_length: 128
Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertForSequenceClassification: ['cls.predictions.transform.dense.weight', 'cls.seq_relationship.bias', 'cls.predictions.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.seq_relationship.weight']

  • This IS expected if you are initializing BertForSequenceClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
  • This IS NOT expected if you are initializing BertForSequenceClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    Some weights of BertForSequenceClassification were not initialized from the model checkpoint at bert-base-uncased and are newly initialized: ['classifier.bias', 'classifier.weight']
    You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
    [ERROR] Data file does not exist!
    Traceback (most recent call last):
    File "C:\Users\RickZZ\OneDrive - University of Southampton\Msc project\FewRel\train_demo.py", line 253, in
    main()
    File "C:\Users\RickZZ\OneDrive - University of Southampton\Msc project\FewRel\train_demo.py", line 159, in main
    test_data_loader = get_loader_pair(opt.test, sentence_encoder,
    File "C:\Users\RickZZ\OneDrive - University of Southampton\Msc project\FewRel\fewshot_re_kit\data_loader.py", line 226, in get_loader_pair
    dataset = FewRelDatasetPair(name, encoder, N, K, Q, na_rate, root, encoder_name)
    File "C:\Users\RickZZ\OneDrive - University of Southampton\Msc project\FewRel\fewshot_re_kit\data_loader.py", line 125, in init
    assert(0)
    AssertionError`
    What should I do to avoid the error?
@lrongzheni
Copy link

Use vals instead of tests:
copy val_.json to test_.json

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