ONNX Model Zoo

medialab-sciencespo/Qwen3-Embedding-0.6B-ONNX

By medialab-sciencespo · ↓ 3 · ♥ 0 · Updated 2025-11-04

What's in this repo

This page lists the files in medialab-sciencespo/Qwen3-Embedding-0.6B-ONNX, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 16 files, including 10 .json, 1 .md, 1 .jinja, 1 .txt, 1 .onnx, 1 .onnx_data
  • Last updated 2025-11-04

ONNX files

File Size Download
onnx/model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

Qwen3-Embedding-0.6B-ONNX

ONNX port of Qwen/Qwen3-Embedding-0.6B.

Onnx-runtime usage

# Requires onnxruntime>=1.22.1
# Requires tokenizers>=0.21.4

import os
import numpy as np
import onnxruntime as ort
from tokenizers import Tokenizer

# Download the model in a folder called Qwen3-Embedding-0.6B-ONNX
model_name_on_disk = "Qwen3-Embedding-0.6B-ONNX"

documents = [
    "The capital of China is Beijing.",
    "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun.",
]

def normalize_l2(array, axis=1, eps=1e-12):
	norm = np.linalg.norm(array, ord=2, axis=axis, keepdims=True)
	norm = np.maximum(norm, eps)
	return array / norm

tokenizer = Tokenizer.from_file(os.path.join(model_name_on_disk, "tokenizer.json"))
tokenizer.enable_padding(direction='left')
encodings = tokenizer.encode_batch(sentences)

ids = np.array([e.ids for e in encodings], dtype=np.int64)
mask = np.array([e.attention_mask for e in encodings], dtype=np.int64)
position_ids = np.array([range(len(e.ids)) for e in encodings], dtype=np.int64)

sess = ort.InferenceSession(os.path.join(model_name_on_disk, "onnx", "model.onnx"), graph_optimization_level=1)

outputs = sess.run(None, {"input_ids": ids, "attention_mask": mask, "position_ids": position_ids})

token_embeddings = outputs[0]
last_token = token_embeddings[:, -1]
embeddings = normalize_l2(last_token)

Model info

feature-extraction sentence-transformers
sentence-transformers onnx qwen3 text-generation transformers sentence-similarity feature-extraction text-embeddings-inference base_model:Qwen/Qwen3-Embedding-0.6B base_model:quantized:Qwen/Qwen3-Embedding-0.6B license:apache-2.0 endpoints_compatible
↓ 3 ♥ 0

Created: 2025-11-04

Updated: 2025-11-04

View on Hugging Face

Files (16)

.gitattributes
1_Pooling/config.json
README.md
added_tokens.json
chat_template.jinja
config.json
config_sentence_transformers.json
merges.txt
modules.json
onnx/model.onnx ONNX
onnx/model.onnx_data
sentence_bert_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json
vocab.json

Related models