Tensorflow hub module taking long time for embedding single sentence
I would recommend using the model like this:
import tensorflow_hub as hub
module_url = &quot;https://tfhub.dev/google/universal-sentence-encoder/4&quot;
model = hub.load(module_url)
print (&quot;module %s loaded&quot; % module_url)
def embed(input):
    return model(input)

And then:
embed([&quot;This is a nice string!&quot;])

Which would return:
&lt;tf.Tensor: shape=(1, 512), dtype=float32, numpy= array([[ 8.84598400e-03, ... , 1.89793427e-02]], dtype=float32)&gt;

That is the 512 dimension vector, but you can choose the one you need between all the encoders here: https://tfhub.dev/
Hope it helps.