Transformers: Problem with downloading the XLNetSequenceClassification pretrained xlnet-large-cased

Created on 25 Apr 2020  路  3Comments  路  Source: huggingface/transformers

I've run this before and it was fine. However, this time, i keep encountering this runtime error. In fact, when i tried to initialize model = XLNetModel.from_pretrained('xlnet-large-cased') - it also gives me the 'negative dimension' error.

model = XLNetForSequenceClassification.from_pretrained("xlnet-large-cased", num_labels = 2) model.to(device)
`---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
in ()
----> 1 model = XLNetForSequenceClassification.from_pretrained("xlnet-large-cased", num_labels = 2)
2 model.to(device)

3 frames
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/sparse.py in __init__(self, num_embeddings, embedding_dim, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse, _weight)
95 self.scale_grad_by_freq = scale_grad_by_freq
96 if _weight is None:
---> 97 self.weight = Parameter(torch.Tensor(num_embeddings, embedding_dim))
98 self.reset_parameters()
99 else:

RuntimeError: Trying to create tensor with negative dimension -1: [-1, 1024]`

Most helpful comment

the problem is when l import xlnet from pytorch_transformers. instead, you should be importing it from the module called 'transformers'

All 3 comments

Hey mate, I've encountered the same issue. How did you solve it?

I encounter this issue. How can I solve this?

the problem is when l import xlnet from pytorch_transformers. instead, you should be importing it from the module called 'transformers'

Was this page helpful?
0 / 5 - 0 ratings