weight-audit
Scan the open-weight AI models a project depends on (Llama, Gemma, Qwen, DeepSeek, and others) for license compliance risk before a scale-cap or acceptable-use restriction turns into a legal problem for a commercial product.
Why
Open-weight models are not all "open source." The Llama Community License caps free commercial use at 700M monthly active users. Gemma, Qwen, and DeepSeek carry acceptable-use policies. CC-BY-NC weights forbid commercial use outright. Roughly 70% of models on Hugging Face ship with no license metadata at all. Enterprise SCA platforms (Endor Labs, Sonatype, Black Duck) now gate on this for large customers -- this tool does the same check for the developers and small AI startups those platforms don't sell to.
Install
pip install weight-audit
Usage
weight-audit scan . # scan a directory (manifest + source detection)
weight-audit scan . --policy policy.json # use a custom policy
weight-audit scan . --json # machine-readable output for CI
weight-audit scan . --online # also query the HF Hub API for models not in the offline DB
weight-audit bom . --output ml-bom.json # generate a CycloneDX ML-BOM
weight-audit report . --license-key <KEY> -o evidence.html # [Pro] compliance evidence report
Exit code is 1 if any model violates the policy, 0 otherwise --
safe to drop into CI:
- run: weight-audit scan .
Detecting models
weight-audit looks for models in two places:
- A
weight-audit-models.txtmanifest in the scanned directory -- one Hugging Face model id per line, with an optional declared license as a second column:meta-llama/Llama-3-8B-Instruct some-org/attributed-model,cc-by-4.0 - A best-effort scan of
.pysource forAutoModel.from_pretrained("org/model")andmodel_id = "org/model"patterns. This is a convenience for a first scan -- for reliable CI gating, use a manifest.
Policy
By default, anything at strong-restriction or above is a violation,
and models with no license metadata at all (unknown) are treated as
violations too. Override with a JSON file:
{
"fail_at_or_above": "weak-restriction",
"treat_unknown_as_violation": false
}
How it classifies
Licenses are bucketed into four tiers: permissive < weak-restriction
< strong-restriction < unknown. 27 named model families (Llama,
Gemma, Qwen, DeepSeek, BLOOM, StarCoder, Baichuan, ChatGLM, Yi, Grok,
FLUX, and others) are matched against a hand-curated offline database
recording their actual restriction -- not just the license name --
so a scale cap or acceptable-use policy shows up as a concrete
obligation, not just a label. See weight_audit/license_db.py for the
exact rules and weight_audit/classify.py for the resolution order.
A broader SPDX/common-identifier fallback table (Apache-2.0, MIT,
CC-BY variants, OpenRAIL variants, and named Llama/Gemma license
strings) covers models outside the named-family list when a license
string is available, either from a manifest's declared_license
column or from --online.
Online mode
--online queries the Hugging Face Hub API for models that aren't in
the offline database and don't have a declared license in the
manifest. It never overrides a license already recorded in the
manifest, and any network failure (timeout, 404, malformed response)
degrades to unknown rather than crashing the scan -- the offline
database remains the reliable default; --online only fills gaps.
Limitations
The offline database is a hand-curated table of well-known model
families, not a registry mirror. Models outside the known families and
without a declared license (from a manifest or --online) are flagged
unknown. This is deliberate: "unknown" surfaces the real state of the
ecosystem (~70% of Hugging Face models carry no license) rather than
silently passing them.
Pro
weight-audit report generates a standalone HTML compliance-evidence
document -- per-model tier, concrete obligation, and violation status,
framed as supporting evidence for EU AI Act Annex IV / Annex XI GPAI
technical documentation and EU CRA record-keeping. scan and bom
stay free and unrestricted; only this evidence-export report requires
a one-time license key ($99):
weight-audit report . --license-key <KEY> -o evidence.html
Unlock it here: https://buy.stripe.com/7sY9AU5FqeKRedPdhcdMI02
(the key can also be set via the WEIGHT_AUDIT_KEY environment
variable instead of --license-key).
Built for AI startups and individual developers who need EU AI Act/CRA-ready evidence without buying into an enterprise SCA platform (Endor Labs, Sonatype, Black Duck) built for a much larger buyer.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file weight_audit-0.1.2.tar.gz.
File metadata
- Download URL: weight_audit-0.1.2.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
470648d9316efeeda264c8c48304c70d58608cd57400e320c679ea3da3bc0f65
|
|
| MD5 |
a49197470d0955d53454fe0c4d0738ce
|
|
| BLAKE2b-256 |
0cfc104c1881acf88465493ee0d2a720ac7db5b64509222daab45a236e809d5b
|
File details
Details for the file weight_audit-0.1.2-py3-none-any.whl.
File metadata
- Download URL: weight_audit-0.1.2-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0790d775d5d69bdc25e34b2bcb6043d31540870b960cbd2d7ed292e5f3c6e79
|
|
| MD5 |
647d6804fbaedc4c48420468b01edcef
|
|
| BLAKE2b-256 |
586e675edb1164f64b2a9b71f06e620c72163def4afaa21c1559f82120fefdaf
|