Skip to content

Add mflux library to model-libraries.ts (closes #2091)#2196

Open
Sanjays2402 wants to merge 1 commit into
huggingface:mainfrom
Sanjays2402:add-mflux-library
Open

Add mflux library to model-libraries.ts (closes #2091)#2196
Sanjays2402 wants to merge 1 commit into
huggingface:mainfrom
Sanjays2402:add-mflux-library

Conversation

@Sanjays2402
Copy link
Copy Markdown

@Sanjays2402 Sanjays2402 commented May 27, 2026

Closes #2091.

What

Registers mflux in packages/tasks/src/model-libraries.ts so models tagged library_name: mflux get download counts.

Why

mflux is a line-by-line MLX port of FLUX / FLUX.2 / Z-Image for Apple Silicon (4k+ stars, actively maintained). Models like filipstrand/FLUX.1-Krea-dev-mflux-4bit and Runpod/FLUX.2-klein-4B-mflux-4bit currently report 0 downloads despite being actively used, because:

  • Most mflux repos ship only safetensors weights + tokenizer files, no config.json
  • The default download counter falls back to config.json and finds nothing
  • Repos that happen to include config.json (e.g. madroid/flux.1-dev-mflux-4bit) do get counted via the fallback, which confirms the gap

How

mflux loads weights via huggingface_hub.snapshot_download with allow_patterns=[file_pattern, "config.json"], so it always requests config.json on every download — even when the repo does not contain one. Matching on that path is the most precise filter for mflux usage without over-counting unrelated safetensors fetches from other libraries.

mflux: {
    prettyLabel: "mflux",
    repoName: "mflux",
    repoUrl: "https://github.com/filipstrand/mflux",
    filter: false,
    countDownloads: `path:"config.json"`,
},

Verification

  • pnpm lint clean
  • pnpm test — 18/18 passing
  • pnpm build — clean

Inserted in alphabetical position between medvae and mitie.


Note

Low Risk
Single registry entry for download analytics only; no auth, inference, or runtime behavior changes.

Overview
Registers the mflux modeling library in packages/tasks/src/model-libraries.ts so Hub models tagged library_name: mflux use a library-specific download counter instead of only the generic defaults.

The new entry points at the mflux repo, keeps it out of the public models filter (filter: false), and sets countDownloads to path:"config.json" (per the diff). The PR text argues many mflux repos lack that file and proposes counting *.safetensors instead—worth confirming the merged query matches the intended metric before ship.

Reviewed by Cursor Bugbot for commit 1304845. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread packages/tasks/src/model-libraries.ts Outdated
Registers mflux (https://github.com/filipstrand/mflux), a line-by-line
MLX port of FLUX/Z-Image image generation models for Apple Silicon.

Models tagged with library_name: mflux currently show 0 downloads
because most mflux repos do not ship config.json (only safetensors
weights + tokenizer files), so the default config.json fallback misses
them. mflux loads weights via huggingface_hub.snapshot_download with
allow_patterns=[file_pattern, "config.json"], so it requests
config.json on every download — matching that path correctly counts
mflux usage without over-counting unrelated safetensors fetches.

Closes huggingface#2091
@Sanjays2402 Sanjays2402 changed the title Add mflux to model-libraries for download tracking Add mflux library to model-libraries.ts (closes #2091) May 29, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1304845. Configure here.

repoName: "mflux",
repoUrl: "https://github.com/filipstrand/mflux",
filter: false,
countDownloads: `path:"config.json"`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

countDownloads uses wrong pattern, defeating the PR's purpose

High Severity

The countDownloads value is set to path:"config.json" but the entire purpose of this PR is to fix download tracking for mflux repos that don't include a config.json. The PR description explicitly states the value should be path_extension:"safetensors", matching how mflux downloads weights. Using path:"config.json" replicates the exact broken fallback behavior this change is meant to fix — most mflux repos will continue showing 0 downloads.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1304845. Configure here.

@Wauplin
Copy link
Copy Markdown
Contributor

Wauplin commented May 29, 2026

mflux loads weights via huggingface_hub.snapshot_download with allow_patterns=[file_pattern, "config.json"], so it always requests config.json on every download — even when the repo does not contain one.

Hey @Sanjays2402 , this assumption is not correct unfortunately. The allow pattern is a filter when downloading a repo that matches which files it should try to load. Since config.json doesn't exist on the repo, the download attempt is not done and therefore the download not counted.

Is there another file that could be used for download count? Otherwise a solution is to add a

# if no config.json file in repo
try:
    # force try to download config.json file to count as a download
    hf_hub_download(repo_id, "config.json", force_download=True)
except EntryNotFound:
    pass # exception is expected, do nothing

snippet in the mflux library to make sure the config file is always called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add mflux library to model-libraries.ts for download tracking

2 participants