Repository navigation
Add a Rankings tab with model ranking charts and a daily data refresh #2049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+4,273
−0
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
10289f9
Add a Rankings tab with static model ranking charts
claude 570d36b
Show ranks only in the top models by use case section
claude 8a94c05
Address review: data-derived period labels, intro wording, script har…
claude 0f32143
Mark a month partial only when the cutoff is before its real last day
claude afc95dd
Drop the Change column from the top models by use case table
claude 76f3bf5
feat(rankings): daily data refresh, hub links, methodology expanders
claude 2cf3b1d
Merge 76f3bf5781c647584da13fe402ff97d21bf0a459 into 506a4a94db30524ad…
charlene-maker 3c46098
Fix link formatting issues
actions-user a09e448
fix(rankings): safer refresh job and download deltas
claude 005fbac
feat(rankings): top models and top movers charts, faster speed sorting
claude 948edd8
feat(rankings): a year of data, monthly views and launch page links
claude 40ccbcf
feat(rankings): Desktop v1 hardware and a linked subtitle
claude c6c3c09
Merge branch 'main' into rankings-tab
claude 8965c19
feat(rankings): link models without a comfy.org page to docs tutorials
claude f0c0941
fix(rankings): count calls with no model name and refresh Hugging Fac…
claude b7b3830
chore(rankings): refresh data through 2026-11-17
claude d4fd6dc
chore(rankings): refresh data through 2026-11-18
claude 794ce0d
chore(rankings): refresh data through 2026-11-19
claude f8d1e9c
chore(rankings): refresh data through 2026-11-20
claude 45f8cde
chore(rankings): refresh data through 2026-11-21
claude 0ddf3b8
chore(rankings): refresh data through 2026-11-22
claude 9b08609
Merge branch 'main' into rankings-tab
charlene-maker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| name: Rankings data refresh | ||
|
|
||
| # Rebuilds the data behind the Rankings tab (rankings/index.mdx) every day at | ||
| # 9am Pacific from Snowflake, PostHog and Hugging Face, then pushes the new | ||
| # snippets/rankings/rankings-data.jsx to main. The raw exports hold internal | ||
| # spend and counts, so they stay in the runner's temp dir; only ranks, shares | ||
| # and times reach the repo. See scripts/rankings/README.md. | ||
| # | ||
| # Needs these repository secrets: SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, | ||
| # SNOWFLAKE_PRIVATE_KEY (or SNOWFLAKE_PASSWORD), SNOWFLAKE_WAREHOUSE, | ||
| # SNOWFLAKE_ROLE (optional), POSTHOG_API_KEY. HF_TOKEN is optional. | ||
| # If main rejects the push, the update goes to a pull request instead. | ||
|
|
||
| on: | ||
| schedule: | ||
| # 9am Pacific is 16:00 UTC in summer time and 17:00 UTC in winter; the | ||
| # first step skips whichever run isn't 9am in Los Angeles. | ||
| - cron: "0 16 * * *" | ||
| - cron: "0 17 * * *" | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: rankings-data-refresh | ||
| cancel-in-progress: false | ||
|
|
||
| # Read-only by default. Only the push job below gets write access, and it never | ||
| # sees the source credentials or runs third-party packages. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| refresh: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| outputs: | ||
| changed: ${{ steps.build.outputs.changed }} | ||
| env: | ||
| BRANCH: chore/rankings-data-refresh | ||
| steps: | ||
| - name: Only run at 9am Pacific | ||
| id: clock | ||
| run: | | ||
| hour=$(TZ=America/Los_Angeles date +%H) | ||
| if [ "${{ github.event_name }}" = "schedule" ] && [ "$hour" != "09" ]; then | ||
| echo "It's ${hour}:00 in Los Angeles, skipping." | ||
| echo "run=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "run=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Checkout | ||
| if: steps.clock.outputs.run == 'true' | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: main | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Python | ||
| if: steps.clock.outputs.run == 'true' | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install the Snowflake connector | ||
| if: steps.clock.outputs.run == 'true' | ||
| run: pip install "snowflake-connector-python==3.12.3" "cryptography>=42" | ||
|
|
||
| - name: Carry over snapshots from an open fallback PR | ||
| if: steps.clock.outputs.run == 'true' | ||
| run: | | ||
| # If an earlier refresh went to the fallback PR, its Hugging Face | ||
| # snapshots aren't on main yet. Merge them in so none are lost. | ||
| state=scripts/rankings/state/hf-downloads.json | ||
| if git show "origin/$BRANCH:$state" > "$RUNNER_TEMP/pr-state.json" 2>/dev/null; then | ||
| python3 - "$state" "$RUNNER_TEMP/pr-state.json" <<'PY' | ||
| import json, sys | ||
| main, pr = (json.load(open(f)) for f in sys.argv[1:]) | ||
| main["totals"] = {**pr["totals"], **main["totals"]} | ||
| with open(sys.argv[1], "w") as f: | ||
| json.dump(main, f, indent=1, sort_keys=True) | ||
| f.write("\n") | ||
| PY | ||
| fi | ||
|
|
||
| - name: Fetch sources and rebuild the data file | ||
| id: build | ||
| if: steps.clock.outputs.run == 'true' | ||
| env: | ||
| SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} | ||
| SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }} | ||
| SNOWFLAKE_PRIVATE_KEY: ${{ secrets.SNOWFLAKE_PRIVATE_KEY }} | ||
| SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} | ||
| SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }} | ||
| SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_ROLE }} | ||
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | ||
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -z "$SNOWFLAKE_ACCOUNT" ] || [ -z "$POSTHOG_API_KEY" ]; then | ||
| echo "::warning::The rankings refresh secrets aren't set yet, so the data was not refreshed." | ||
| exit 0 | ||
| fi | ||
| # Data runs through yesterday (UTC), the last full day. | ||
| through=$(date -u -d yesterday +%F) | ||
| python3 scripts/rankings/fetch-rankings-sources.py "$RUNNER_TEMP/rankings" "$through" | ||
| python3 scripts/rankings/build-rankings-data.py "$RUNNER_TEMP/rankings" snippets/rankings/rankings-data.jsx "$through" | ||
| if git diff --quiet -- snippets/rankings/rankings-data.jsx scripts/rankings/state/hf-downloads.json; then | ||
| echo "No changes." | ||
| else | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| # Only the two generated files go to the push job; the raw CSVs stay here. | ||
| - name: Hand the generated files to the push job | ||
| if: steps.build.outputs.changed == 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: rankings-data | ||
| path: | | ||
| snippets/rankings/rankings-data.jsx | ||
| scripts/rankings/state/hf-downloads.json | ||
| retention-days: 1 | ||
|
|
||
| push: | ||
| needs: refresh | ||
| if: needs.refresh.outputs.changed == 'true' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| BRANCH: chore/rankings-data-refresh | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: main | ||
|
|
||
| - name: Get the generated files | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: rankings-data | ||
|
|
||
| - name: Push the new data | ||
| run: | | ||
| set -euo pipefail | ||
| files="snippets/rankings/rankings-data.jsx scripts/rankings/state/hf-downloads.json" | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git add $files | ||
| git commit -m "chore(rankings): refresh rankings data through $(date -u -d yesterday +%F)" | ||
| if git push origin HEAD:main; then | ||
| exit 0 | ||
| fi | ||
| # The refresh job already merged any snapshots from this branch, so | ||
| # replacing it loses nothing. | ||
| echo "main rejected the push; opening a pull request instead." | ||
| git push -f origin "HEAD:refs/heads/$BRANCH" | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| if [ -z "$(gh pr list --head "$BRANCH" --base main --state open --json number --jq '.[0].number // empty')" ]; then | ||
| gh pr create --base main --head "$BRANCH" \ | ||
| --title "chore(rankings): refresh rankings data" \ | ||
| --body "Daily refresh of the Rankings tab data by the rankings-data-refresh workflow. Only ranks, shares and times are in the diff." | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4635,6 +4635,12 @@ | |
| } | ||
| ] | ||
| }, | ||
| { | ||
| "tab": "Rankings", | ||
| "pages": [ | ||
| "rankings/index" | ||
| ] | ||
| }, | ||
| { | ||
| "tab": "Support", | ||
| "pages": [ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| title: "Generative Model Rankings" | ||
| sidebarTitle: "Model rankings" | ||
| description: "Rankings are generated via real live data from our Comfy Dev Platform and public datasets. Data is refreshed daily at 9am PST." | ||
| mode: "wide" | ||
| --- | ||
|
|
||
| import { ModelRankings, SubtitleLink } from "/snippets/rankings/model-rankings.jsx"; | ||
| import { RANKINGS_DATA } from "/snippets/rankings/rankings-data.jsx"; | ||
|
|
||
| <SubtitleLink phrase="Comfy Dev Platform" href="https://comfy.org/platform/" /> | ||
|
|
||
| <ModelRankings data={RANKINGS_DATA} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Rankings data pipeline | ||
|
|
||
| The [Rankings tab](../../rankings/index) reads one generated file, | ||
| `snippets/rankings/rankings-data.jsx`. It holds ranks, shares and times only. | ||
| Raw spend, call counts and install counts never enter the repo. | ||
|
|
||
| ## Daily refresh | ||
|
|
||
| `.github/workflows/rankings-data-refresh.yml` runs every day at 9am Pacific | ||
| (two UTC crons plus a clock check, so daylight saving time is handled). It: | ||
|
|
||
| 1. Runs `fetch-rankings-sources.py <tmp dir> <yesterday>`, which writes four CSVs to the runner's temp dir: | ||
| - `model_generations.csv`: Snowflake, `queries/model_generations.sql`, generations per model and week for the last 52 full Monday-start UTC weeks (Top models and Top movers). The build groups the weeks into months and quarters. | ||
| - `cloud_model_speed_all.csv`: Snowflake, `queries/cloud_model_speed.sql`, every Cloud job in the last year, never before Dec 1, 2025, when Cloud started recording job start and end times. Set `RANKINGS_SPEED_START` to override the start. | ||
| - `hardware_weekly.csv`: PostHog HogQL, `queries/hardware_weekly.hogql`, one count per Desktop install per Monday-start week for the last year, from July 6, 2026 at the earliest (the Desktop hardware report starts in June 2026). | ||
| - `model_downloads_typed.csv`: Hugging Face public download totals for the repos in `hf-repos.json`. | ||
| 2. Runs `build-rankings-data.py <tmp dir> snippets/rankings/rankings-data.jsx <yesterday>`. | ||
| 3. Commits the data file and `state/hf-downloads.json` to `main`. If `main` rejects the push, it opens a PR from `chore/rankings-data-refresh` instead. | ||
|
|
||
| You can also start it by hand from the Actions tab (workflow_dispatch). | ||
|
|
||
| ### Secrets | ||
|
|
||
| Add these as repository secrets. Until `SNOWFLAKE_ACCOUNT` and `POSTHOG_API_KEY` exist, the job logs a warning and changes nothing. | ||
|
|
||
| | Secret | Notes | | ||
| |--------|-------| | ||
| | `SNOWFLAKE_ACCOUNT` | Account identifier | | ||
| | `SNOWFLAKE_USER` | A read-only service user | | ||
| | `SNOWFLAKE_PRIVATE_KEY` | Unencrypted PEM for key-pair auth (preferred) | | ||
| | `SNOWFLAKE_PASSWORD` | Only if not using a key | | ||
| | `SNOWFLAKE_WAREHOUSE` | Warehouse to run the two queries | | ||
| | `SNOWFLAKE_ROLE` | Optional; needs read on `ANALYTICS_PROD.STAGING` and `ANALYTICS_PROD.CORE` | | ||
| | `POSTHOG_API_KEY` | Personal API key with `query:read` on project 204330 | | ||
| | `HF_TOKEN` | Optional, only raises Hugging Face rate limits | | ||
|
|
||
| ## Downloads caveat | ||
|
|
||
| Hugging Face's API only exposes running totals, so each run saves that day's | ||
| totals in `state/hf-downloads.json`. A week's or month's downloads are the | ||
| difference between snapshots, and a period with no snapshot near its start is | ||
| skipped. Periods up to Nov 16, 2026 came from publisher analytics and keep their | ||
| shares; `build-rankings-data.py` merges new periods into the existing data file | ||
| rather than replacing it. | ||
|
|
||
| `hf-repos.json` lists each repo under its current Hugging Face name. Comfy-Org | ||
| renamed many repos in November 2026 (like `Wan_2.2_ComfyUI_Repackaged` to | ||
| `Wan-2.2`); `was` keeps the old name so the hub page links still match. | ||
|
|
||
| ## Desktop v1 hardware | ||
|
|
||
| The legacy Desktop app (v1) sent its telemetry to Mixpanel, which lands in | ||
| Snowflake (`STG_MIXPANEL_DESKTOP__EVENTS` and `__PROFILES`). It stopped at the | ||
| end of May 2026, so its weekly shares (Oct 20, 2025 to May 10, 2026) are a fixed | ||
| file, `state/hardware-desktop-v1.json`, and the daily job doesn't query it. | ||
|
|
||
| ## Output types | ||
|
|
||
| `model-types.json` sets the output type (Image, Video, Speech, 3D) of every | ||
| model already on the page. A new model gets its type from its calls' use case | ||
| in `model_generations.sql`; add it to the file to fix a wrong guess. | ||
|
|
||
| ## Model page links | ||
|
|
||
| Model names link to their page on the Comfy Hub (https://comfy.org/hub/models/) | ||
| when one exists. Models without a hub page link to their launch page on | ||
| comfy.org (like https://comfy.org/minimax-h3/) when a pattern in | ||
| `model-pages.json` matches the name. Add a pattern there when comfy.org adds a | ||
| launch page. Models with no page on comfy.org at all link to | ||
| their docs.comfy.org tutorial when a pattern in `docs-pages.json` matches. The page list is `hub-pages.json`, built from a checkout of the | ||
| private Comfy-Org/comfy-website repo. Rebuild it by hand when the hub adds models: | ||
|
|
||
| ```bash | ||
| python3 scripts/rankings/build-hub-pages.py ../comfy-website scripts/rankings/hub-pages.json | ||
| ``` | ||
|
|
||
| The next daily run picks it up. | ||
|
|
||
| ## Running locally | ||
|
|
||
| ```bash | ||
| python3 scripts/rankings/fetch-rankings-sources.py /tmp/rankings 2026-10-20 | ||
| python3 scripts/rankings/build-rankings-data.py /tmp/rankings snippets/rankings/rankings-data.jsx 2026-10-20 | ||
| ``` | ||
|
|
||
| Keep the CSVs out of the repo. Running the fetch locally also adds a snapshot to | ||
| `state/hf-downloads.json`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Builds scripts/rankings/hub-pages.json, the list of model pages on | ||
| # https://comfy.org/hub/models/ that the Rankings tables link to. It reads the | ||
| # page lists from a checkout of Comfy-Org/comfy-website (private), so run it by | ||
| # hand when the hub adds models, then rerun build-rankings-data.py. | ||
| # Usage: python3 scripts/rankings/build-hub-pages.py <comfy-website checkout> scripts/rankings/hub-pages.json | ||
| import json, re, sys, collections | ||
|
|
||
| SITE, OUT = sys.argv[1], sys.argv[2] | ||
| CFG = f"{SITE}/apps/website/src/config" | ||
|
|
||
| with open(f"{CFG}/model-urls.ts", encoding="utf-8") as f: | ||
| src = f.read() | ||
| pages = re.findall(r"oldSlug: '([^']+)',\s*newSlug: '([^']+)'", src) | ||
| aliases = re.findall(r"alias: '([^']+)',\s*newSlug: '([^']+)'", src) | ||
| with open(f"{CFG}/generated-models.json", encoding="utf-8") as f: | ||
| files = [m for m in json.load(f) if m["directory"] != "partner_nodes"] | ||
|
|
||
| # API models: page ids are provider--model--task, aliases provider--model. | ||
| # A model id that two providers share (like "v3") is ambiguous, so it's dropped. | ||
| by_model = collections.defaultdict(set) | ||
| for old, new in pages + aliases: | ||
| p = old.split("--") | ||
| by_model[p[1].lower()].add((p[0], new)) | ||
| api = {m: sorted({n for _, n in v}) for m, v in by_model.items() if len({p for p, _ in v}) == 1} | ||
|
|
||
| # Local model files: one page per file under /hub/models/local, quantized | ||
| # copies point at their main file's page. | ||
| local = {} | ||
| for m in files: | ||
| local[m["slug"]] = m.get("canonicalSlug") or m["slug"] | ||
|
|
||
| # Hugging Face repo -> its file pages, for the downloads table. | ||
| repos = collections.defaultdict(list) | ||
| for m in files: | ||
| r = re.match(r"https://huggingface.co/([^/]+/[^/?#]+)", m.get("huggingFaceUrl") or "") | ||
| if r and not m.get("canonicalSlug"): | ||
| repos[r.group(1)].append(m["slug"]) | ||
|
|
||
| with open(OUT, "w", encoding="utf-8") as f: | ||
| json.dump({"api": api, "pages": sorted({n for _, n in pages}), "local": local, "repos": repos}, f, indent=1, sort_keys=True) | ||
| f.write("\n") |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: Comfy-Org/docs
Length of output: 4119
🏁 Script executed:
Repository: Comfy-Org/docs
Length of output: 12251
Pin both actions to full commit SHAs.
actions/checkout@v7andactions/setup-python@v5use mutable tags. This workflow grants repository write permissions and later runs steps with source credentials. If either tag changes, replacement action code can run with those privileges. Pin each action to a verified full commit SHA to reduce this supply-chain risk.🧰 Tools
🪛 zizmor (1.30.1)
[warning] 46-50: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 48-48: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changing this one. The repo's other workflows use the same version tags (17 use
actions/checkout@v7). I also can't look up and check the commit SHAs from here, and I'd rather not commit unverified ones. The write-scoped job is now separate and runs no third-party code apart from checkout and download-artifact. Pinning every workflow to SHAs would be a good follow-up change for the whole repo.Generated by Claude Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@charlene-maker Thanks for the context. I won’t press for SHA pinning in this PR. The mutable-tag risk remains, but a repository-wide hardening follow-up is reasonable.
Would you like me to open a GitHub issue for that follow-up?
✏️ Learnings added
You are interacting with an AI system.