Feature Extraction
sentence-transformers
Safetensors
Transformers
qwen3
text-generation
sentence-similarity
text-embeddings-inference
Instructions to use Qwen/Qwen3-Embedding-0.6B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Qwen/Qwen3-Embedding-0.6B with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use Qwen/Qwen3-Embedding-0.6B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Qwen/Qwen3-Embedding-0.6B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-Embedding-0.6B") model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-Embedding-0.6B", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
ONNX conversion
#18
by shuttie - opened
This is a SBERT-based ONNX conversion of the model.
Code used:
from sentence_transformers import (
SentenceTransformer,
export_dynamic_quantized_onnx_model,
)
model = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B", backend="onnx")
model.save_pretrained("export")
for tpe in ["arm64", "avx2", "avx512", "avx512_vnni"]:
export_dynamic_quantized_onnx_model(model, tpe, "export")
Note that latest stable optimum version as for today (1.25.3) does not yet support onnx conversion of qwen3-based models, but it's available in master. So you need to have the following requirements.txt:
sentence-transformers
optimum[onnxruntime]@git+https://github.com/huggingface/optimum.git
Also a side note: exporting optimized model does not work due to lack of Qwen3 onnx optimization support in Optimum.
shuttie changed pull request title from onnx to ONNX conversion
shuttie changed pull request status to open
Thanks! I have been testing the qint8_avx512 model and can confirm its working as expected.
Also, it would be nice if we could get a bfloat16 or a float16 converted model as well. I guess the model.onnx is f32?