Downloads · 30 days
0
Ringoacid/qwen-attention-onnx
qwen-attention-onnx is a text generation model from Ringoacid. Use it when you need the model to write or continue text. It is set up for transformers.js. The card lists the license as apache-2.0.
ONNX export of Qwen/Qwen2.5-Coder-0.5B, quantized to uint4 and extended with per-layer attention weight outputs for browser-based visualization with ONNX Runtime Web.
Downloads · 30 days
0
Access
Public
Updated May 17, 2026
Repo size
789 MB
Likes
0
Public
Click a slice to open those files.
.data774 MB · 98%
From the Hugging Face model README
ONNX export of Qwen/Qwen2.5-Coder-0.5B, quantized to uint4 and extended with per-layer attention weight outputs for browser-based visualization with ONNX Runtime Web.
| File | Size | Description |
|---|---|---|
qwen_with_attention_uint4.onnx | ~3 MB | Model graph (references external weights) |
qwen_with_attention_uint4.onnx.data | ~739 MB | uint4-quantized weights |
tokenizer.json | ~11 MB | Tokenizer |
| Name | Shape | Description |
|---|---|---|
logits | [1, seq, 151936] | Next-token logits |
attentions_0 … attentions_23 | [1, 14, seq, seq] | Per-layer attention weights (14 heads × 24 layers) |
import * as ort from 'onnxruntime-web';
import { AutoTokenizer } from '@huggingface/transformers';
const BASE = 'https://huggingface.co/YOUR_HF_USER/qwen-attention-onnx/resolve/main';
const tokenizer = await AutoTokenizer.from_pretrained(
'onnx-community/Qwen2.5-Coder-0.5B-Instruct'
);
const modelBuffer = new Uint8Array(await fetch(`${BASE}/qwen_with_attention_uint4.onnx`).then(r => r.arrayBuffer()));
const dataBuffer = new Uint8Array(await fetch(`${BASE}/qwen_with_attention_uint4.onnx.data`).then(r => r.arrayBuffer()));
const session = await ort.InferenceSession.create(modelBuffer, {
executionProviders: ['webgpu', 'cpu'],
externalData: [{ path: 'qwen_with_attention_uint4.onnx.data', data: dataBuffer }],
});
const ids = tokenizer.encode('def hello():', { add_special_tokens: false });
const n = ids.length;
const outputs = await session.run({
input_ids: new ort.Tensor('int64', BigInt64Array.from(ids.map(BigInt)), [1, n]),
attention_mask: new ort.Tensor('int64', BigInt64Array.from(new Array(n).fill(1n)), [1, n]),
});
// outputs.logits — next-token logits
// outputs.attentions_0 — layer 0 attention weights