model in closed network

#43
by iamwhoiamm - opened

hi there

is there a way to download this model to closed, offline network?

Sentence Transformers org

You can download it to a device that does have internet, e.g. using git clone https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2, and then copy the files over using ssh or something (presumably you have some method to access a machine in the network). You can then place the model in some folder, e.g. ~/all-MiniLM-L6-v2-sentence-transformer-model and load it via:

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("~/all-MiniLM-L6-v2-sentence-transformer-model")

on your airgapped network. Then the model should work as normal. Feel free to let me know if that doesn't work, or open an issue on https://github.com/UKPLab/sentence-transformers

  • Tom Aarsen

is it possible to download it directly without using git?

Sentence Transformers org
edited Jan 30

Definitely! You can go to the files here and just click the ⬇️ download button on all of the files (don't forget the config.json in the 1_Pooling folder).

and once i get the folder in my network, how can i use the model in my python code?

also, how can alter this code

from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
embeddings = model.encode(sentences)
print(embeddings)

to print the actual grade as well, not just the embeddings?

thanks in advance

Sign up or log in to comment