Skip to content

Create the branch before pushing a LoRA GGUF to a revision - #13915

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:lora-gguf-revision-branch
Oct 18, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:lora-gguf-revision-branch

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

Pushing a LoRA adapter as GGUF to a branch that does not exist yet, with push_to_hub_gguf(..., save_method="lora", revision="v2") or push_to_hub_ggml(..., revision="v2"), failed with a Hub error after the conversion had already finished. The converted file was then deleted with the temp folder, so the only way out was to create the branch by hand and convert again. The merged and quantized GGUF pushes already create the branch first and work with the same arguments.

The LoRA GGUF upload now creates the requested branch before uploading, the same way the other GGUF and merged uploads do. Pull request revisions (refs/pr/N) are left alone, and a pull request to a branch without write access still goes through. Pushes without a revision, or to a branch that already exists, behave as before.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T20:39:09.315329Z 79c0053 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: ec8c9a91f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 308618a80f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@NilayYadav NilayYadav left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review + reproduction evidence

Pinned review: 308618a80f. 3 minor findings on the submitted head ec8c9a91f6, fixed in 308618a80f.

I reproduced a LoRA GGUF push to a new branch on fresh upstream main (Linux, NVIDIA L4, huggingface_hub 1.30.0, transformers 5.16.1): load unsloth/SmolLM2-135M-Instruct, add a r=8 LoRA, train 3 steps, then model.push_to_hub_gguf(repo, tokenizer, save_method="lora", revision="v2") on a fresh private repo.

  • main 5e55110: the conversion runs, then the upload fails with RevisionNotFoundError: 404 ... Invalid rev id: v2. The repo only has main with .gitattributes, and the converted file is gone. push_to_hub_ggml(revision="v3") fails the same way.
  • PR head 308618a: Unsloth: Done. Uploaded to https://huggingface.co/<user>/<repo>/tree/v2, branches ['main', 'v2'], and the .gguf is on v2. push_to_hub_ggml(revision="v3") lands on v3. A second push to v2 succeeds.

PR 13915 before/after

Fixed in 308618a:

  • create_pr=True with revision="v4": huggingface_hub 1.20 and later refuse this in upload_folder (Cannot use create_pr=True with revision='v4'). The submitted head created v4 first, so the call failed and still left a stray v4 branch on the repo. The branch is now only created when no pull request is requested, so the outcome matches main.
  • The done message always printed the repo root. It now points at /tree/<revision>, /discussions/<n> or the new pull request.
  • The new test was not listed in consolidated-tests-ci.yml, so no CI job ran it. It is now in both CPU lists.

Unchanged on all three builds: a push with no revision, revision="main", create_pr=True, and a push into refs/pr/1. Studio's export never passes revision or save_method="lora" to this function, so Studio is not affected. The only cost is one extra Hub call, and only when a new branch is requested.

Tests on GPU, main vs this head: tests/saving/test_push_to_hub_lora_gguf_revision.py gives 4 failed, 5 passed on main and 9 passed on the PR.

Conclusion: the bug is real and fixed. The adjacent upload paths are unchanged. Merge once upstream CI is green.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 79c0053b01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen added a commit that referenced this pull request Oct 15, 2026
…p guards (#13936)

Two more checks are red on main (7382805), seen on #13915 and
#13922's run, both reproduced locally on main.

## `test_no_raw_pixel_text_utilities` (from #13850)

```
Raw px text utilities ignore the UI font size preference; use the text-ui-* / leading-ui-* tokens in index.css instead:
  features/studio/sections/token-preview-dialog.tsx: text-[12.5px]
  features/studio/sections/token-preview-dialog.tsx: text-[9px]
```

The new token preview dialog sized three text runs with raw
`text-[12.5px]` / `text-[9px]`, so they stay fixed when the user changes
Settings > UI font size while the rest of Studio scales. The contract is
right and the dialog is what changes. `index.css` has exact tokens for
both sizes, `--text-ui-12p5: calc(0.78125rem * var(--ui-font-scale, 1))`
and `--text-ui-9: calc(0.5625rem * var(--ui-font-scale, 1))`, so this
swaps to `text-ui-12p5` / `text-ui-9`. At the default scale of 1 those
resolve to the same 12.5px and 9px, so the dialog renders the same as
today; the only difference is that it now follows the font size setting.
No screenshots: there is nothing visible to compare at the default
scale.

## `test_no_skip_guard_reads_a_spoofable_accelerator_probe` (from #13830
and #13889)

```
test_fp8_rowwise_gemv_blackwell_gate.py:47: torch.cuda.is_available()
test_norm_fast_launch.py:189: torch.cuda.device_count()
```

`tests/_zoo_aggressive_cuda_spoof.py` patches the torch.cuda probes to
report a GPU process-wide for the version-compat suites, so a skip guard
that reads them un-skips on a CPU-only runner whenever it shares a
pytest session with those suites. Both guards now ask `has_real_cuda()`
from `tests/_shared/real_accelerator.py` (answered before any spoof),
the form the rest of the tree uses: `not has_real_cuda()` for the FP8
GEMV exactness test, and `not has_real_cuda() or
torch.cuda.device_count() < 2` for the two-GPU norm test, matching
`test_rms_layernorm_multirow.py`. On a real GPU the predicate is the
same as before.

## Verification

- `tests/studio/test_ui_font_scale_contract.py`: fails on main as above,
12 passed here. Prettier clean.
- `tests/python/test_accelerator_skip_guards.py`: fails on main as
above, 24 passed here.
- On CPU, `test_fp8_rowwise_gemv_blackwell_gate.py` and
`test_norm_fast_launch.py`: 6 passed, 4 skipped (the GPU cases, with
their reasons), same as main.
- Not run here: the GPU cases themselves. This host's CUDA torch
environment fails bitsandbytes CUDA setup at collection, unrelated to
this change; the test bodies are untouched.
@danielhanchen
danielhanchen merged commit 6f645a1 into unslothai:main Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants