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
Metadata
Release files for weight-audit 0.1.3
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 |
|---|---|---|---|---|
| weight_audit-0.1.3.tar.gz | 22.3 kB | Without provenance | Details for weight_audit-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| weight_audit-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for weight_audit-0.1.3-py3-none-any.whl |
Total release size: 42.7 kB
Release files / weight_audit-0.1.3.tar.gz
| Download URL | weight_audit-0.1.3.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c0a7a5a544e8e9d6ca69bc89cc921e168f6f6b02a746279de3baeb5763b2a0d
|
|
BLAKE2b-256 checksum How to use checksums |
5081d9b030276d9394c6c34c631dbca3fd12a2c101aa74f0ac3b73f1b62994c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / weight_audit-0.1.3-py3-none-any.whl
| Download URL | weight_audit-0.1.3-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee071da04d76709a029c3fa9ff068d6088f59642f00db78d69fd809ae944ca64
|
|
BLAKE2b-256 checksum How to use checksums |
ac0723ed69ee9d1a53e6061d5f9e6137c5a6b88318999d56db316ac66ceac93e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for weight-audit 0.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.