FewRel
FewRel copied to clipboard
How to run the demo code?
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?
Use vals instead of tests: copy val_.json to test_.json