jiesutd / NCRFpp

NCRF++, a Neural Sequence Labeling Toolkit. Easy use to any sequence labeling tasks (e.g. NER, POS, Segmentation). It includes character LSTM/CNN, word LSTM/CNN and softmax/CRF components.
Apache License 2.0
1.88k stars 447 forks source link

didn't match because some of the arguments have invalid types: (list) #15

Closed sc268 closed 6 years ago

sc268 commented 6 years ago

Hi I'm trying to run the demo traning: python main.py --config demo.train.config, then got

 ++++++++++++++++++++++++++++++++++++++++
 Hyperparameters:
     Hyper              lr: 0.015
     Hyper        lr_decay: 0.05
     Hyper         HP_clip: None
     Hyper        momentum: 0.0
     Hyper              l2: 1e-08
     Hyper      hidden_dim: 200
     Hyper         dropout: 0.5
     Hyper      lstm_layer: 1
     Hyper          bilstm: True
     Hyper             GPU: True
DATA SUMMARY END.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build network...
use_char:  True
char feature extractor:  CNN
word feature extractor:  LSTM
use crf:  True
build word sequence feature extractor: LSTM...
build word representation...
build char sequence feature extractor: CNN ...
build CRF...
Epoch: 0/1
 Learning rate is setted as: 0.015
Traceback (most recent call last):
  File "main.py", line 436, in <module>
    train(data)
  File "main.py", line 326, in train
    batch_word, batch_features, batch_wordlen, batch_wordrecover, batch_char, batch_charlen, batch_charrecover, batch_label, mask  = batchify_with_label(instance, data.HP_gpu)
  File "main.py", line 234, in batchify_with_label
    mask[idx, :seqlen] = torch.Tensor([1]*seqlen)
TypeError: mul() received an invalid combination of arguments - got (list), but expected one of:
 * (Tensor other)
      didn't match because some of the arguments have invalid types: (list)
 * (float other)
      didn't match because some of the arguments have invalid types: (list)

Any suggestion would be appreciated. Thanks!

jiesutd commented 6 years ago

Hi @seanschang , which version is your PyTorch? This toolkit is only available for pytorch 0.3, currently it does not compatible with PyTorch0.4.

sc268 commented 6 years ago

Hi @jiesutd, confirmed the source code works for PyTorch 0.3.1 but not 0.4. Thanks!

jiesutd commented 6 years ago

Thanks for the feedback!