Shen-Lab / TALE

Transformer-based protein function Annotation with joint feature-Label Embedding
https://doi.org/10.1093/bioinformatics/btab198
MIT License
32 stars 11 forks source link

A BUG occurs when I try to run train.py just in the default way. #2

Open maovshao opened 2 years ago

maovshao commented 2 years ago
iteration 1/1197 totaltrain_loss:0.695 regular loss 0.017
iteration 2/1197 totaltrain_loss:0.675 regular loss 0.017 
iteration 3/1197 totaltrain_loss:0.651 regular loss 0.018
iteration 4/1197 totaltrain_loss:0.626 regular loss 0.019
iteration 5/1197 totaltrain_loss:0.601 regular loss 0.019
iteration 6/1197 totaltrain_loss:0.575 regular loss 0.019
iteration 7/1197 totaltrain_loss:0.550 regular loss 0.019
iteration 8/1197 totaltrain_loss:0.525 regular loss 0.019
Traceback(most recent call last):
  File"train.py",line 317,in <module>
    model1.train()
  File"train.py",line 205,in train
    x= cut(train_x[ite*batch_size: (ite+1)*batch_size],hparams['MAXLEN'])
  File"train.py",line 32,in cut
    start = np.random.randint(i-maxlen+1)
  File"mtrand.pyx",line 743,in numpy.random.mtrand.RandomState.randint
  File"_bounded_integers.pyx",line 1275,in numpy.random.bounded_integers._rand_int64
  File"_bounded_integers.pyx",line 687,in numpy.random._bounded_integers._rand_int64_broadcast
ValueError:low >= high

It seems that the "maxlen" in train.py is setted to a wrong value, causing "i-maxlen+1" to be a negative number. I just tried to run the code in the default way. My run command is: python train.py --batch_size 32 --epochs 100 --lr 1e-3 --save_path ./log/ --ontology mf --data_path ../data/ours/ --regular_lambda 0 (By the way, it seems that you need to renew the "Readme.md" because the commend of it is too old to work normally. The folder "../data/" has changed.) Could you help me solve the BUG? It's quite important for my work. Thanks, and best wishes for you.

Shen-Lab commented 2 years ago

Thank you for your interest in our work and our code. @YueCao2017 @YueCao94 Could you please address the questions? If you did not receive notification about this issue earlier, please click "watch" for your repos, get notifications when issues are opened in future, and respond to them in time. Thank you.

YueCao94 commented 2 years ago

Hi,

Thank you for your interest in our code. The bug has been fixed and you should run the code normally right now.