xypan1232 / iDeepE

inferring RBP binding sites and motifs using local and global CNNs
16 stars 9 forks source link

IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number #4

Closed aishsk87 closed 4 years ago

aishsk87 commented 4 years ago

Hi I am running as follows: python ideepe.py --posi=RBM20_peaks_positive.fa --nega=HNRNPL-human.fa --model_type=CNN --model_file=RBM20.model.pkl --train=True ===> Using GPU Namespace(batch_size=100, channel=7, ensemble=True, glob=False, local=False, maxsize=501, model_file='RBM20.model.pkl', model_type='CNN', motif=False, motif_dir='motifs', n_epochs=50, nega='HNRNPL-human.fa', num_filters=16, out_file='prediction.txt', posi='RBM20_peaks_positive.fa', predict=False, testfile='', train=True, window_size=101) ensembling model training for CNN maxpool_size 496 (7004, 1, 4, 507) /home/aishwarya/.local/lib/python2.7/site-packages/torch/nn/functional.py:1351: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead. warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.") Traceback (most recent call last): File "ideepe.py", line 1122, in run_ideepe(args) File "ideepe.py", line 1037, in run_ideepe model_file=model_file + '.global', batch_size=batch_size, n_epochs=n_epochs, num_filters=num_filters, motif=motif, motif_seqs=motif_seqs, motif_outdir=motif_outdir) File "ideepe.py", line 924, in train_network clf.fit(X_train, y_train, batch_size=batch_size, nb_epoch=n_epochs) File "ideepe.py", line 338, in fit loss = self._fit(train_loader) File "ideepe.py", line 323, in _fit loss_list.append(loss.data[0]) IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

python version Python 2.7.15 tensorboard 2.1.0 tensorflow 2.1.0 numpy 1.16.6

aishsk87 commented 4 years ago

Sorry I just saw in the description that you have mentioned what needs to be changed if the pytorch version is >= 0.4