{"id":47287542,"url":"https://github.com/zerfoo/zonnx","last_synced_at":"2026-04-01T21:26:03.405Z","repository":{"id":311107242,"uuid":"1041767013","full_name":"zerfoo/zonnx","owner":"zerfoo","description":"ONNX-to-GGUF model converter CLI. Convert HuggingFace ONNX models to GGUF format for use with Zerfoo and llama.cpp. CGo-free, single static binary.","archived":false,"fork":false,"pushed_at":"2026-03-26T15:36:47.000Z","size":183,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-27T00:33:29.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerfoo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-21T01:30:37.000Z","updated_at":"2026-03-26T15:40:08.000Z","dependencies_parsed_at":"2025-08-22T07:24:41.360Z","dependency_job_id":"93c66e2d-4729-4047-b13f-676fbaaa5a5c","html_url":"https://github.com/zerfoo/zonnx","commit_stats":null,"previous_names":["zerfoo/zonnx"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/zerfoo/zonnx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerfoo%2Fzonnx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerfoo%2Fzonnx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerfoo%2Fzonnx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerfoo%2Fzonnx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerfoo","download_url":"https://codeload.github.com/zerfoo/zonnx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerfoo%2Fzonnx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-16T06:16:34.237Z","updated_at":"2026-04-01T21:26:03.393Z","avatar_url":"https://github.com/zerfoo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zonnx\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/zerfoo/zonnx.svg)](https://pkg.go.dev/github.com/zerfoo/zonnx)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nStandalone CLI for converting ONNX and SafeTensors models to GGUF format. Ships as a single static binary — zero CGo.\n\nPart of the [Zerfoo](https://github.com/zerfoo) ML ecosystem.\n\n## Features\n\n- **ONNX / SafeTensors to GGUF** — produce portable GGUF files compatible with [zerfoo](https://github.com/zerfoo/zerfoo) and llama.cpp\n- **Post-conversion quantization** — quantize weights to Q4_0 or Q8_0 during conversion\n- **HuggingFace integration** — download ONNX models and tokenizer files in one step\n- **Model inspection** — introspect metadata, IOs, nodes, and tensor stats for ONNX and GGUF files\n- **Architecture-aware mappings** — tensor name and metadata mappings tuned per model family\n- **CGo-free** — single static binary, easy to distribute and run in minimal containers\n\n## Installation\n\n```bash\ngo install github.com/zerfoo/zonnx/cmd/zonnx@latest\n```\n\nOr build from source:\n\n```bash\ngo build -o zonnx ./cmd/zonnx\n```\n\nRequires Go 1.26+. `CGO_ENABLED=0` works.\n\n## Quick Start\n\n```bash\n# Download an ONNX model from HuggingFace\nzonnx download --model google/gemma-2-2b-it --output ./models\n\n# Convert ONNX to GGUF\nzonnx convert --arch gemma --output ./models/model.gguf ./models/model.onnx\n\n# Convert SafeTensors to GGUF\nzonnx convert --format safetensors --arch bert --output ./models/model.gguf ./models/bert-dir/\n\n# Convert with quantization\nzonnx convert --quantize q4_0 --output ./models/model-q4.gguf ./models/model.onnx\n\n# Inspect a model file\nzonnx inspect --pretty ./models/model.gguf\n```\n\n## Supported Architectures\n\n| Architecture | `--arch` | Input Formats | Notes |\n|-------------|----------|---------------|-------|\n| Llama | `llama` (default) | ONNX | Llama 3, Code Llama |\n| Gemma | `gemma` | ONNX | Gemma, Gemma 2, Gemma 3 |\n| BERT | `bert` | ONNX, SafeTensors | Classification, embeddings |\n| RoBERTa | `roberta` | ONNX, SafeTensors | Same layer structure as BERT |\n\nAny architecture string can be passed via `--arch`. Metadata mapping is generic; tensor name mapping currently covers decoder (Llama-style) and encoder (BERT/RoBERTa) models.\n\n## Commands\n\n### `convert`\n\n```\nzonnx convert [flags] \u003cinput\u003e\n```\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `--output` | `\u003cinput\u003e.gguf` | Output GGUF file path |\n| `--arch` | `llama` | Model architecture for metadata/tensor mapping |\n| `--format` | `onnx` | Input format: `onnx` or `safetensors` |\n| `--quantize` | (none) | Quantize weights: `q4_0` or `q8_0` |\n\n### `download`\n\n```\nzonnx download --model \u003chuggingface-model-id\u003e [--output \u003cdir\u003e] [--api-key \u003ckey\u003e]\n```\n\nThe `--api-key` flag takes precedence over the `HF_API_KEY` environment variable.\n\n### `inspect`\n\n```\nzonnx inspect [--type onnx|gguf] [--pretty] \u003cinput-file\u003e\n```\n\nType is inferred from file extension when not specified.\n\n## Metadata Mapped\n\nThese HuggingFace `config.json` fields are mapped to GGUF metadata for all architectures:\n\n| config.json field | GGUF key |\n|-------------------|----------|\n| `hidden_size` | `{arch}.embedding_length` |\n| `num_hidden_layers` | `{arch}.block_count` |\n| `num_attention_heads` | `{arch}.attention.head_count` |\n| `num_key_value_heads` | `{arch}.attention.head_count_kv` |\n| `intermediate_size` | `{arch}.feed_forward_length` |\n| `vocab_size` | `{arch}.vocab_size` |\n| `max_position_embeddings` | `{arch}.context_length` |\n| `rms_norm_eps` | `{arch}.attention.layer_norm_rms_epsilon` |\n| `rope_theta` | `{arch}.rope.freq_base` |\n\nBERT/RoBERTa additionally map `layer_norm_eps`, `num_labels`, and `pooler_type`.\n\n## Design Principles\n\n- **GGUF-only output** — emits only GGUF files, no runtime code\n- **No `zerfoo` imports** — strictly decoupled from the inference runtime\n- **Explicit schema** — GGUF output captures all model attributes directly\n\n## Development\n\n```bash\nmake test       # go test ./...\nmake lint       # golangci-lint run\nmake format     # gofmt + goimports\n```\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerfoo%2Fzonnx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerfoo%2Fzonnx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerfoo%2Fzonnx/lists"}