weaviate / t2v-transformers-models

This is the repo for the container that holds the models for the text2vec-transformers module
BSD 3-Clause "New" or "Revised" License
39 stars 27 forks source link

Make text embedding dynamic (same as model output size) #12

Closed StefanBogdan closed 2 years ago

StefanBogdan commented 3 years ago

The current implementation requires to specify the output dimension of the transformer model. This is due to pre-allocating the memory for the batch embeddings. This can be fixed by not pre-allocating the memory for the batch embeddings but use them directly. This solution does not need to specify the output dimension (redundant information prone to errors).

NOTE: PyTorch/TensorFlow allows for Tensor + Constant arithmetics, i.e. you can add a python primitive type constant (int or float) to a tensor and vice-versa, the result is always a Tensor.