AlexWortega/tinystories-33m-onnx

🤗 Hugging Face 来源text-generationapache-2.0648 MBother✓ 2 个校验和今天更新
一条命令提交

在你的模型文件夹旁边运行它。它会制作种子、将文件与 Hugging Face 比对,然后提交。你只需开始做种,并粘贴你账户中的密钥。它只读取你的文件,绝不修改。如果愿意,可以先阅读脚本。

curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo AlexWortega/tinystories-33m-onnx ./model-folder
需要做种者 →

TinyStories-33M — ONNX (fp32 + q4) for transformers.js / WebGPU

ONNX export of roneneldan/TinyStories-33M prepared for client-side WebGPU inference via @huggingface/transformers.

Files

file size dtype
onnx/model.onnx ~417 MB fp32 (full precision fallback)
onnx/model_q4.onnx ~211 MB 4-bit weights (recommended for WebGPU)

Export recipe

Mirrors the pipeline in AlexWortega/PhysicsLLMEngine/inference:

optimum-cli export onnx \
    --model roneneldan/TinyStories-33M \
    --task text-generation-with-past \
    --opset 18 \
    ./out_onnx

Then 4-bit quantization:

from onnxruntime.quantization.matmul_nbits_quantizer import MatMulNBitsQuantizer
quant = MatMulNBitsQuantizer("model.onnx", bits=4, block_size=32, is_symmetric=True)
quant.process()
quant.model.save_model_to_file("model_q4.onnx", use_external_data_format=False)

The q4f16 step from the original recipe was skipped: applying onnxconverter-common.float16.convert_float_to_float16 on top of the post-quantization graph deadlocked (>60 min wall on a 33M model, the MatMulNBits custom op interacted badly with the type rewriter). Plain dtype: "q4" runs cleanly under the WebGPU EP, which is what the demo uses.

Usage (transformers.js)

import { pipeline } from "@huggingface/transformers";
const gen = await pipeline("text-generation", "AlexWortega/tinystories-33m-onnx", {
    device: "webgpu",
    dtype: "q4",
});
const out = await gen("Once upon a time, the little girl", {
    max_new_tokens: 120, temperature: 0.8, top_k: 40, do_sample: true,
});
console.log(out[0].generated_text);

Live demo: AlexWortega/ml-intern-v4-100m-tinystories-demo (Space slug kept from the earlier PyTorch experiment; same URL, now serves this WebGPU build).