ONNX Model Zoo

iwaitu/qwen3-embedding-0.6b-onnx

By iwaitu · ↓ 0 · ♥ 0 · Updated 2026-03-14

What's in this repo

This page lists the files in iwaitu/qwen3-embedding-0.6b-onnx, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 7 files, including 2 .json, 1 .md, 1 .jinja, 1 .onnx, 1 .data
  • Last updated 2026-03-14

ONNX files

File Size Download
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

interface sample:

import numpy as np
import onnxruntime as ort
from transformers import AutoTokenizer

class QwenEmbeddingONNX:
    def __init__(self, model_dir, model_path, max_length=512, providers=None):
        self.max_length = max_length
        self.tokenizer = AutoTokenizer.from_pretrained(model_dir)

        if providers is None:
            providers = ['CPUExecutionProvider']

        self.session = ort.InferenceSession(
            model_path,
            providers=providers
        )

        self.input_names = [i.name for i in self.session.get_inputs()]

    def encode(self, texts, normalize=True):
        if isinstance(texts, str):
            texts = [texts]

        inputs = self.tokenizer(
            texts,
            padding=True,
            truncation=True,
            max_length=self.max_length,
            return_tensors="np",
        )

        input_feed = {
            k: inputs[k].astype(np.int64)
            for k in self.input_names
            if k in inputs
        }

        outputs = self.session.run(None, input_feed)
        embeddings = outputs[0]

        # 如果输出是 [B, L, H],取第一个 token
        if embeddings.ndim == 3:
            embeddings = embeddings[:, 0, :]

        # L2 normalize
        if normalize:
            norm = np.linalg.norm(embeddings, axis=1, keepdims=True)
            embeddings = embeddings / (norm + 1e-9)

        return embeddings

Model info

onnx base_model:Qwen/Qwen3-Embedding-0.6B base_model:quantized:Qwen/Qwen3-Embedding-0.6B license:mit region:us
↓ 0 ♥ 0

Created: 2026-03-14

Updated: 2026-03-14

View on Hugging Face

Files (7)

.gitattributes
README.md
chat_template.jinja
model.onnx ONNX
model.onnx.data
tokenizer.json
tokenizer_config.json

Related models