Views
No views yet
roneneldan/TinyStories-33M
prepared for client-side WebGPU inference via
@huggingface/transformers.| file | size | dtype |
|---|---|---|
onnx/model.onnx | ~417 MB | fp32 (full precision fallback) |
onnx/model_q4.onnx | ~211 MB | 4-bit weights (recommended for WebGPU) |
AlexWortega/PhysicsLLMEngine/inference:1optimum-cli export onnx \
2 --model roneneldan/TinyStories-33M \
3 --task text-generation-with-past \
4 --opset 18 \
5 ./out_onnx1from onnxruntime.quantization.matmul_nbits_quantizer import MatMulNBitsQuantizer
2quant = MatMulNBitsQuantizer("model.onnx", bits=4, block_size=32, is_symmetric=True)
3quant.process()
4quant.model.save_model_to_file("model_q4.onnx", use_external_data_format=False)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.1import { pipeline } from "@huggingface/transformers";
2const gen = await pipeline("text-generation", "AlexWortega/tinystories-33m-onnx", {
3 device: "webgpu",
4 dtype: "q4",
5});
6const out = await gen("Once upon a time, the little girl", {
7 max_new_tokens: 120, temperature: 0.8, top_k: 40, do_sample: true,
8});
9console.log(out[0].generated_text);AlexWortega/ml-intern-v4-100m-tinystories-demo
(Space slug kept from the earlier PyTorch experiment; same URL, now serves
this WebGPU build).