amansrivastava17 / embedding-as-service

One-Stop Solution to encode sentence to fixed length vectors from various embedding techniques
MIT License
204 stars 29 forks source link

XLNet encoding issue #32

Closed harrypb closed 4 years ago

harrypb commented 4 years ago

Please consider the following code.

from embedding_as_service.text.encode import Encoder en = Encoder(embedding='xlnet', model='xlnet_base_cased', download=True) vecs = en.encode(texts=["hello, how are you?"])

The above code gives the following error. I'm using python 3.6 (I've run using spyder)

ValueError: Trying to share variable model/transformer/r_w_bias, but specified shape (12, 12, 64) and found shape (24, 16, 64)

By the way, I'm able to generate the embeddings through bert.

Thanks, Hari

ashutoshsingh0223 commented 4 years ago

The code seems fine. I wasn't able to reproduce this error though. The setting you are trying to use is a default, where it should share the bias variable. I tried it on CPU, GPU, and TPU runtimes.

Can you share your tensorflow and keras versions? Also whether you were using CPU or not?