Views
No views yet
yasserrmd/glm5.1-distill,
produced with the official Liquid AI ONNX exporter:
Liquid4All/onnx-export.LiquidAI/LFM2.5-1.2B-Instruct-ONNX),
so the same inference snippets work here unchanged.onnx/
model_fp16.onnx
model_fp16.onnx_data
model_fp16.onnx_data_1
model_q4.onnx
model_q4.onnx_data
model_q8.onnx
model_q8.onnx_data*.onnx_data, *.onnx_data_1,
... All data files must sit next to their .onnx graph.1import numpy as np
2import onnxruntime as ort
3from huggingface_hub import hf_hub_download, list_repo_files
4from transformers import AutoTokenizer
5
6model_id = "{TARGET_REPO_ID}"
7graph = "onnx/model_q4.onnx" # recommended
8
9# Download the graph and all of its external-data shards
10hf_hub_download(model_id, graph)
11for f in list_repo_files(model_id):
12 if f.startswith(graph + "_data") or f.startswith(graph + ".onnx_data"):
13 hf_hub_download(model_id, f)
14
15session = ort.InferenceSession(hf_hub_download(model_id, graph))
16tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)LiquidAI/LFM2.5-1.2B-Instruct-ONNX.1import {{ AutoModelForCausalLM, AutoTokenizer, TextStreamer }} from "@huggingface/transformers";
2
3const modelId = "{TARGET_REPO_ID}";
4const tokenizer = await AutoTokenizer.from_pretrained(modelId);
5const model = await AutoModelForCausalLM.from_pretrained(modelId, {{
6 device: "webgpu",
7 dtype: "q4", // or "fp16"
8}});
9
10const messages = [{{ role: "user", content: "Hello!" }}];
11const input = tokenizer.apply_chat_template(messages, {{
12 add_generation_prompt: true, return_dict: true,
13}});
14
15const streamer = new TextStreamer(tokenizer, {{ skip_prompt: true }});
16const output = await model.generate({{ ...input, max_new_tokens: 256, do_sample: false, streamer }});
17console.log(tokenizer.decode(output[0], {{ skip_special_tokens: true }}));q4 for CPU/GPU/WebGPU, fp16 for higher quality on GPU/WebGPU, q8 for server-only quality/size balance.Liquid4All/onnx-export. See the upstream README for the exact CLI used.{SOURCE_MODEL_ID}.