UKPLab / sentence-transformers

State-of-the-Art Text Embeddings
https://www.sbert.net
Apache License 2.0
15.31k stars 2.48k forks source link

Error transposing in WKPooling #270

Closed radkoff closed 4 years ago

radkoff commented 4 years ago

Hi, I'm trying to use WKPooling on your fine-tuned roberta base models, but I'm getting:

File ".../lib/python3.7/site-packages/sentence_transformers/models/WKPooling.py", line 47, in forward
    token_embedding = self.unify_token(token_feature)
  File ".../lib/python3.7/site-packages/sentence_transformers/models/WKPooling.py", line 75, in unify_token
    Q, R = torch.qr(window_matrix.T)
AttributeError: 'Tensor' object has no attribute 'T'

AFAIK there is no .T in pytorch. Should it be torch.transpose?

sentence-transformers==0.2.6.1
transformers==2.11.0
pytorch-pretrained-bert==0.6.2
torch==1.1.0
nreimers commented 4 years ago

It might be that .T was added in a newer version of pytorch. Try to update it to the latest release.

radkoff commented 4 years ago

Thanks that was it, didn't realize how behind I was