MODEL UNFOLDER
your one click model unfolder
from model_unfolder import unfold
unfold("meta-llama/Meta-Llama-3-8B")
Install
pip install model-unfolder
# for local development
pip install -e .
pip install transformers # only required to load by model ID
Three ways to call it
from model_unfolder import unfold
# 1) by HuggingFace model ID — only config.json is downloaded, never weights
unfold("meta-llama/Meta-Llama-3-8B")
unfold("deepseek-ai/DeepSeek-V3")
# 2) from a transformers AutoConfig
from transformers import AutoConfig
unfold(AutoConfig.from_pretrained("Qwen/Qwen2.5-7B", trust_remote_code=True))
# 3) from a raw config.json dict — no transformers install needed
import json
unfold(json.load(open("config.json")))
Built on transformers
Pass a model ID and unfold calls transformers.AutoConfig.from_pretrained(model_id) under the hood (parser.py). It only retries with trust_remote_code=True when Transformers says the config requires remote code.
Auth-token from your environment
Gated models (Llama-3, Mistral, Gemma, …) need a HuggingFace token. unfold reuses whatever transformers / huggingface_hub already see:
# Either set an env var
export HF_TOKEN="hf_xxxxxxxx" # also accepted: HUGGING_FACE_HUB_TOKEN
# or use the CLI cache (persists across sessions)
huggingface-cli login
# or load a .env in your notebook
# >>> from dotenv import load_dotenv; load_dotenv()
No extra config in model_unfolder itself.
Save / export
diagram = unfold(cfg)
diagram.save("model.html") # standalone interactive HTML
diagram.save("model.json") # expanded architecture JSON (no rendering)
diagram.param_count() # {"total": ..., "active": ..., "per_layer": [...]}
diagram.to_ir() # full IR dict
Param estimates are close to published numbers — DeepSeek-V3 reports ~675B (~41B active), Llama-3-8B reports 8.03B.
Models supported
Transformers
| Family | Models |
|---|---|
| DeepSeek | DeepSeek-V2, DeepSeek-V3 (+ MTP head), Kimi K2 |
| Llama | Llama 3 / 3.1 / 3.2 / 3.3, OLMo-2, Llama 4 Scout / Maverick (MoE + iRoPE NoPE layers) |
| Mistral | Mistral 7B, Mixtral 8x7B / 8x22B, Mistral Medium 3.5 |
| Qwen | Qwen2 / 2.5, Qwen2-MoE, Qwen3, Qwen3-MoE, Qwen3.5 / 3.6 (+ MTP) |
| Gemma | Gemma 2 9B / 27B (interleaved local+global), Gemma 3 / 3n (+ PLE), Gemma 4 31B / E2B / E4B (+ PLE), RecurrentGemma 2B / 9B (LRU + local attention) |
| Cohere | Command R, Command R+, Command R7B (QK-Norm attention) |
| Jamba | Jamba (SSM + attention hybrid, MoE) |
| Zamba | Zamba 7B, Zamba2 2.7B / 7B (Mamba SSM + weight-shared attention) |
| Mamba | Mamba 130M–2.8B, Mamba-2 (pure SSM, no attention) |
| Falcon | Falcon 7B / 40B (parallel attn+FFN), Falcon-H1 (Mamba-2 SSM) |
| MiniMax | MiniMax-Text-01 (lightning + softmax hybrid, MoE) |
| RWKV | RWKV-4 / 5 / 6 (pure recurrent, no attention) |
Diffusors
Coming soon.
Custom
Drop a request in issues.
License
Metadata
Release files for model-unfolder 0.2.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| model_unfolder-0.2.17.tar.gz | 640.7 kB | With provenance | Details for model_unfolder-0.2.17.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| model_unfolder-0.2.17-py3-none-any.whl | Python 3 | none | any | Details for model_unfolder-0.2.17-py3-none-any.whl |
Total release size: 1.2 MB
Release files / model_unfolder-0.2.17.tar.gz
| Download URL | model_unfolder-0.2.17.tar.gz |
|---|---|
| Size | 640.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ad74a00edd2eb8fbf93fb0ca9d09293a513211f8b6fe49fe20cba7fa0b869cd
|
|
BLAKE2b-256 checksum How to use checksums |
54f02922f9a288cf4448632d8efd279c55eb5e244d9d0741ffe2066ec9fa8276
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logRelease files / model_unfolder-0.2.17-py3-none-any.whl
| Download URL | model_unfolder-0.2.17-py3-none-any.whl |
|---|---|
| Size | 571.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
186029f4a8fd95e73c37fa068a913b96be244076b87ba97cdc81979d865b5def
|
|
BLAKE2b-256 checksum How to use checksums |
bbd9aaf7db5df600bfcb3bd5fea5f8c9c7e9be8c6f90177cb9936fac2e9437be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logSecurity for model-unfolder 0.2.17
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for model_unfolder-0.2.17.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.