Closed tobimichigan closed 4 years ago
Hi, could you try updating your pytorch version to 1.2.0 ?
Same issue here. Pytorch==1.2.0, python==3.6.2
What exactly is your issue @ukliu ?
What exactly is your issue @ukliu ?
I was going through the pytorch-transformers tutorial at https://github.com/ukliu/pytorch-transformers
All others seems fine, but TransfoXLModel gives an error of AttributeError: 'Tensor' object has no attribute 'bool'
That's mainly a pytorch version issue. You can upgrade your pytorch or change the type to torch.uint8 rather than call the .bool() function.
🐛 Bug
Model I am using (from the official repo):
Language I am using the model on (English, Yoruba,Igbo, Hausa etc):
The problem arise when using:
The tasks I am working on is:
To Reproduce
Steps to reproduce the behavior:
1.python -m pytest -sv ./pytorch_transformers/tests/
`pytorch_transformers/tests/modeling_transfo_xl_test.py::TransfoXLModelTest::test_transfo_xl_lm_head FAILED pytorch_transformers/tests/modeling_transfo_xl_test.py::TransfoXLModelTest::test_transfo_xl_model FAILED pytorch_transformers/tests/tokenization_xlnet_test.py::XLNetTokenizationTest::test_tokenizer_no_lower PASSED
=================================== FAILURES =================================== __ TransfoXLModelTest.test_attention_outputs ___
self =
pytorch_transformers/tests/modeling_common_test.py:73:
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py:493: in call result = self.forward(*input, **kwargs) pytorch_transformers/modeling_transfo_xl.py:1253: in forward outputs = self._forward(input_ids, mems=mems, head_mask=head_mask)
self = TransfoXLModel( (word_emb): AdaptiveEmbedding( (emb_layers): ModuleList( (0): Embedding(10, 32) (1):... LayerNorm(torch.Size([32]), eps=1e-05, elementwise_affine=True) ) ) ) (pos_emb): PositionalEmbedding() ) dec_inp = tensor([[19, 69, 72, 42, 32, 34, 52, 38, 81, 71, 81, 47, 44], [22, 12, 3, 26, 63, 25, 64, 52, 79, 71, 17, 16,... [82, 26, 62, 95, 55, 79, 8, 90, 33, 83, 64, 53, 68], [ 7, 57, 63, 40, 74, 77, 50, 77, 19, 7, 53, 38, 19]]) mems = [tensor([[[0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0.,... [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.], [0., 0., 0., ..., 0., 0., 0.]]])] head_mask = [None, None, None, None, None]
pytorch_transformers/modeling_transfo_xl.py:1145: AttributeError
pytorch_transformers/tests/modeling_common_test.py:185:
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py:493: in call result = self.forward(*input, **kwargs) pytorch_transformers/modeling_transfo_xl.py:1253: in forward outputs = self._forward(input_ids, mems=mems, head_mask=head_mask) E AttributeError: 'Tensor' object has no attribute 'bool'
pytorch_transformers/modeling_transfoxl.py:1145: AttributeError ____ TransfoXLModelTest.test_hidden_statesoutput ____
self =
pytorch_transformers/tests/modeling_common_test.py:249:
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py:493: in call result = self.forward(*input, **kwargs) pytorch_transformers/modeling_transfo_xl.py:1253: in forward outputs = self._forward(input_ids, mems=mems, head_mask=head_mask)
pytorch_transformers/modeling_transfo_xl.py:1145: AttributeError __ TransfoXLModelTest.test_transfo_xl_lm_head __
self =
pytorch_transformers/tests/modeling_transfo_xl_test.py:201:
pytorch_transformers/tests/modeling_transfo_xl_test.py:142: in create_transfo_xl_lm_head lm_logits_1, mems_1 = model(input_ids_1) /usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py:493: in call result = self.forward(*input, *kwargs) pytorch_transformers/modeling_transfo_xl.py:1349: in forward transformer_outputs = self.transformer(input_ids, mems=mems, head_mask=head_mask) /usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py:493: in call result = self.forward(input, **kwargs) pytorch_transformers/modeling_transfo_xl.py:1253: in forward E AttributeError: 'Tensor' object has no attribute 'bool'
pytorch_transformers/modeling_transfo_xl.py:1145: AttributeError =============================== warnings summary =============================== -- Docs: http://doc.pytest.org/en/latest/warnings.html ======= 5 failed, 206 passed, 10 skipped, 36 warnings in 171.71 seconds ======== `
Expected behavior
Seamless execution!!!
Environment
==============NVSMI LOG==============
Timestamp : Sat Aug 31 11:09:33 2019 Driver Version : 418.67 CUDA Version : 10.1
Attached GPUs : 1 GPU 00000000:00:04.0 Product Name : Tesla K80 Product Brand : Tesla
Why do these attribute errors occur?