I directly run the script following README, but obtained abnormal results for NYT Exact Match setting, with the F1 = 0.667201.
My command is
python -m main --bert_directory ../pretrained_model/bert_base_uncased_huggingface/ --num_generated_triplets 15 --max_grad_norm 1 --na_rel_coef 0.5 --max_epoch 100 --max_span_length 10
Here is some excerpted logs which might be attributed to:
Unparsed args: ['--num_generated_triplets', '15']
dataset_name : NYT-exact
train_file : ./data/NYT/exact_data/train.json
valid_file : ./data/NYT/exact_data/valid.json
test_file : ./data/NYT/exact_data/test.json
generated_data_directory : ./data/generated_data/
generated_param_directory : ./data/generated_data/model_param/
bert_directory : ../pretrained_model/bert_base_uncased_huggingface/
partial : False
model_name : Set-Prediction-Networks
num_generated_triples : 10
num_decoder_layers : 3
matcher : avg
na_rel_coef : 0.5
rel_loss_weight : 1
head_ent_loss_weight : 2
tail_ent_loss_weight : 2
fix_bert_embeddings : True
batch_size : 8
max_epoch : 100
gradient_accumulation_steps : 1
decoder_lr : 2e-05
encoder_lr : 1e-05
lr_decay : 0.01
weight_decay : 1e-05
max_grad_norm : 1.0
optimizer : AdamW
n_best_size : 100
max_span_length : 10
refresh : False
use_gpu : True
visible_gpu : 1
random_seed : 1
DATA SUMMARY START:
Relation Alphabet Size: 24
Train Instance Number: 56196
Valid Instance Number: 5000
Test Instance Number: 5000
DATA SUMMARY END.
Data setting is saved to file: ./data/generated_data/NYT-exact_Set-Prediction-Networks_data.pickle
=== Epoch 99 train ===
Instance: 800; loss: 0.0072
Instance: 1600; loss: 0.0061
Instance: 2400; loss: 0.0053
Instance: 3200; loss: 0.0054
Instance: 4000; loss: 0.0055
Instance: 4800; loss: 0.0049
Instance: 5600; loss: 0.0045
Instance: 6400; loss: 0.0046
Instance: 7200; loss: 0.0042
Instance: 8000; loss: 0.0041
Instance: 8800; loss: 0.0044
Instance: 9600; loss: 0.0043
Instance: 10400; loss: 0.0046
Instance: 11200; loss: 0.0046
Instance: 12000; loss: 0.0046
Instance: 12800; loss: 0.0043
Instance: 13600; loss: 0.0042
Instance: 14400; loss: 0.0040
Instance: 15200; loss: 0.0040
Instance: 16000; loss: 0.0039
Instance: 16800; loss: 0.0038
Instance: 17600; loss: 0.0037
Instance: 18400; loss: 0.0036
Instance: 19200; loss: 0.0035
Instance: 20000; loss: 0.0035
Instance: 20800; loss: 0.0035
Instance: 21600; loss: 0.0034
Instance: 22400; loss: 0.0034
Instance: 23200; loss: 0.0033
Instance: 24000; loss: 0.0034
Instance: 24800; loss: 0.0033
Instance: 25600; loss: 0.0033
Instance: 26400; loss: 0.0033
Instance: 27200; loss: 0.0034
Instance: 28000; loss: 0.0034
Instance: 28800; loss: 0.0034
Instance: 29600; loss: 0.0033
Instance: 30400; loss: 0.0035
Instance: 31200; loss: 0.0038
Instance: 32000; loss: 0.0038
Instance: 32800; loss: 0.0038
Instance: 33600; loss: 0.0037
Instance: 34400; loss: 0.0039
Instance: 35200; loss: 0.0039
Instance: 36000; loss: 0.0039
Instance: 36800; loss: 0.0038
Instance: 37600; loss: 0.0038
Instance: 38400; loss: 0.0039
Instance: 39200; loss: 0.0039
Instance: 40000; loss: 0.0039
Instance: 40800; loss: 0.0039
Instance: 41600; loss: 0.0038
Instance: 42400; loss: 0.0038
Instance: 43200; loss: 0.0038
Instance: 44000; loss: 0.0039
Instance: 44800; loss: 0.0039
Instance: 45600; loss: 0.0041
Instance: 46400; loss: 0.0041
Instance: 47200; loss: 0.0040
Instance: 48000; loss: 0.0040
Instance: 48800; loss: 0.0039
Instance: 49600; loss: 0.0039
Instance: 50400; loss: 0.0039
Instance: 51200; loss: 0.0039
Instance: 52000; loss: 0.0039
Instance: 52800; loss: 0.0039
Instance: 53600; loss: 0.0039
Instance: 54400; loss: 0.0039
Instance: 55200; loss: 0.0039
Instance: 56000; loss: 0.0039
=== Epoch 99 Test ===
------Num of Gold Triplet is 1------
gold_num = 3240 pred_num = 3732 right_num = 2409 relation_right_num = 2826 entity_right_num = 2864
precision = 0.6454983922829582 recall = 0.7435185185185185 f1_value = 0.6910499139414802
rel_precision = 0.7572347266881029 rel_recall = 0.8722222222222222 rel_f1_value = 0.810671256454389
ent_precision = 0.767416934619507 ent_recall = 0.8839506172839506 ent_f1_value = 0.8215720022948939
------Num of Gold Triplet is 2------
gold_num = 2094 pred_num = 1675 right_num = 1309 relation_right_num = 1425 entity_right_num = 1476
precision = 0.7814925373134328 recall = 0.625119388729704 f1_value = 0.6946139559564872
rel_precision = 0.8507462686567164 rel_recall = 0.6805157593123209 rel_f1_value = 0.7561687450252057
ent_precision = 0.8811940298507462 ent_recall = 0.7048710601719198 ent_f1_value = 0.7832316264261078
------Num of Gold Triplet is 3------
gold_num = 942 pred_num = 590 right_num = 501 relation_right_num = 537 entity_right_num = 542
precision = 0.8491525423728814 recall = 0.5318471337579618 f1_value = 0.6540469973890339
rel_precision = 0.9101694915254237 rel_recall = 0.5700636942675159 rel_f1_value = 0.7010443864229765
ent_precision = 0.9186440677966101 ent_recall = 0.5753715498938429 ent_f1_value = 0.7075718015665795
------Num of Gold Triplet is 4------
gold_num = 1160 pred_num = 619 right_num = 530 relation_right_num = 576 entity_right_num = 559
precision = 0.8562197092084006 recall = 0.45689655172413796 f1_value = 0.59584035975267
rel_precision = 0.9305331179321487 rel_recall = 0.496551724137931 rel_f1_value = 0.6475548060708264
ent_precision = 0.9030694668820679 ent_recall = 0.4818965517241379 ent_f1_value = 0.628442945474986
------Num of Gold Triplet is greater than or equal to 5------
gold_num = 684 pred_num = 266 right_num = 241 relation_right_num = 254 entity_right_num = 251
precision = 0.9060150375939849 recall = 0.35233918128654973 f1_value = 0.5073684210526316
rel_precision = 0.9548872180451128 rel_recall = 0.3713450292397661 rel_f1_value = 0.5347368421052632
ent_precision = 0.943609022556391 ent_recall = 0.3669590643274854 ent_f1_value = 0.5284210526315789
------Normal Triplets------
gold_num = 2028 pred_num = 2259 right_num = 1414 relation_right_num = 1725 entity_right_num = 1604
precision = 0.6259406817175741 recall = 0.6972386587771203 f1_value = 0.6596687660368556
rel_precision = 0.7636122177954847 rel_recall = 0.8505917159763313 rel_f1_value = 0.8047585724282714
ent_precision = 0.7100486941124391 ent_recall = 0.7909270216962525 ent_f1_value = 0.748308840681129
------Multiply label Triplets------
gold_num = 4079 pred_num = 2511 right_num = 2052 relation_right_num = 2202 entity_right_num = 2255
precision = 0.8172043010752689 recall = 0.5030644765873988 f1_value = 0.6227617602427922
rel_precision = 0.8769414575866189 rel_recall = 0.5398381956361853 rel_f1_value = 0.6682852807283762
ent_precision = 0.8980485862206292 ent_recall = 0.5528315763667565 ent_f1_value = 0.684370257966616
------Overlapping Triplets------
gold_num = 5530 pred_num = 4243 right_num = 3319 relation_right_num = 3608 entity_right_num = 3791
precision = 0.7822295545604525 recall = 0.6001808318264015 f1_value = 0.6792182543742965
rel_precision = 0.8503417393353759 rel_recall = 0.6524412296564195 rel_f1_value = 0.7383607899314436
ent_precision = 0.8934716002828188 ent_recall = 0.6855334538878842 ent_f1_value = 0.7758109076025785
gold_num = 8120 pred_num = 6882 right_num = 4990 relation_right_num = 5618 entity_right_num = 5692
precision = 0.7250799186283057 recall = 0.6145320197044335 f1_value = 0.6652446340487934
rel_precision = 0.8163324614937518 rel_recall = 0.691871921182266 rel_f1_value = 0.7489668044260765
ent_precision = 0.8270851496657948 ent_recall = 0.7009852216748769 ent_f1_value = 0.7588321557125718
Best result on test set is 0.667201 achieving at epoch 90.
/pytorch/torch/csrc/utils/python_arg_parser.cpp:756: UserWarning: This overload of add_ is deprecated:
add_(Number alpha, Tensor other)
Consider using one of the following signatures instead:
add_(Tensor other, *, Number alpha)
Right now I'm guessing two possible reasons:
1.I see that the README has just updated recently, so I have not set --num_generated_triplets
correctly, but I'm not sure this would lead to dramaticly performance drop from expected 90 to 66.
2.The script and model default to set fix_bert_embeddings=True
, as can be refered to here, which is not the usual case where people finetune BERT on downstream tasks instead of freeze it.
Great thanks for your attention and help!