131250208 / TPlinker-joint-extraction

438 stars 94 forks source link

This overload of nonzero is deprecated: nonzero() #57

Closed sssirus closed 3 years ago

sssirus commented 3 years ago

已经采用了Python 3.6 和Pytorch == 1.6.0。没有报错,但validating时弹出如下warning:

project: mydata, run_name: TP1+cln+BERT, Epoch: 1/30, batch: 906/906, train_loss: 5.107356892121548, t_ent_sample_acc: 0.0, t_head_rel_sample_acc: 0.0, t_tail_rel_sample_acc: 0.0,lr: 2.5e-05, batch_time: 0.3293604850769043, total_time: 255.5144166946411 -------------run_id: 0ZY3nezV, {'train_loss': 5.107356892121548, 'train_ent_seq_acc': 0.0, 'train_head_rel_acc': 0.0, 'train_tail_rel_acc': 0.0, 'learning_rate': 2.5e-05, 'time': 255.5144166946411} Validating: 0%| | 0/75 [00:00<?, ?it/s]C:\Users\ylx\PycharmProjects\TPlinker-joint-extraction-master\tplinker\tplinker0.py:145: UserWarning: This overload of nonzero is deprecated: nonzero() Consider using one of the following signatures instead: nonzero(*, bool as_tuple) (Triggered internally at ..\torch\csrc\utils\python_arg_parser.cpp:882.) for shaking_inds in shaking_tag.nonzero():

sssirus commented 3 years ago

是pytorch版本不一致导致的。torch.nonzero(shaking_tag,as_tuple=False)即可