kolloldas / torchnlp

Easy to use NLP library built on PyTorch and TorchText
Apache License 2.0
254 stars 44 forks source link

is there a way to port it to 0.3.0? #2

Closed udion closed 6 years ago

udion commented 6 years ago

Can you please update it for pytorch 0.3.0 as pytorch 0.2.0 is long gone and runs very slow on many new gpus

kolloldas commented 6 years ago

Sorry missed this. Are you having trouble running it on PyTorch 0.3.0? Seems to work fine on my system. The minimum required version is 0.2.0 but should run fine on the latest version. I'll check on 0.4.0 and update this thread.

djstrong commented 6 years ago

There are problems with pytorch 0.4 and cuda.

_________________________________________________________________________________________ test_softmax_output_layer _________________________________________________________________________________________

    def test_softmax_output_layer():
        hidden = Variable(torch.randn(2, 3, 4))
        labels = Variable(torch.ones(2, 3).long())
        softmax = SoftmaxOutputLayer(4, 8)
        loss = softmax.loss(hidden, labels)
>       assert loss.shape[0] == 1
E       IndexError: tuple index out of range

../../../../../../repos/torchnlp/tests/modules/test_outputs.py:12: IndexError
___________________________________________________________________________________________ test_crf_output_layer ___________________________________________________________________________________________

    def test_crf_output_layer():
        hidden = Variable(torch.randn(2, 3, 4))
        labels = Variable(torch.ones(2, 3).long())
        crf = CRFOutputLayer(4, 8)
        loss = crf.loss(hidden, labels)
>       assert loss.shape[0] == 1
E       IndexError: tuple index out of range

../../../../../../repos/torchnlp/tests/modules/test_outputs.py:21: IndexError
kolloldas commented 6 years ago

@djstrong Thanks for pointing that out! I have just migrated the library to use Pytorch 0.4.0. All tests are passing now and I was able to train the CoNLL2000 dataset on a GPU without issues. Please give it a try and let me know if you still find problems.