Skip to main content
Allows you to set parameters when registering a sentence-transformers object.
Sentence transformer embeddings are normalized by default. It is recommended to use normalized embeddings for similarity search.
ParameterTypeDefault ValueDescription
namestrall-MiniLM-L6-v2The name of the model
devicestrcpuThe device to run the model on (can be cpu or gpu)
normalizeboolTrueWhether to normalize the input text before feeding it to the model
trust_remote_codeboolFalseWhether to trust and execute remote code from the model’s Huggingface repository
You can also load many other model architectures from the library. For example models from sources such as BAAI, Nomic, Salesforce Research, etc. See this HF hub page for all supported models.
Here is an example that uses the BAAI embedding model from the Hugging Face Hub supported models.
Visit sentence-transformers HuggingFace HUB page for more information on the available models.