Skip to content

Inkling 2 tests: utf-8 source reads, and pin the shared compile-disable helper - #19133

Merged
danielhanchen merged 1 commit into
mainfrom
ci/inkling2-support-utf8-reads
Nov 23, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/inkling2-support-utf8-reads

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

Two tests are broken on main.

  1. tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding is red in Repo tests (CPU, rest-2) for every PR based on main, for example Studio: keep different GGUF quants of the same repo alongside (#19072) #19122:

    Left contains one more item: 'tests/test_inkling2_support.py:633: read_text()'
    

    Inkling 2: merged 16-bit save and GGUF export #19016 added (_ROOT / "unsloth" / "save.py").read_text(). It reads a checked-in file with the platform default encoding, which breaks on Windows as soon as save.py gains a non-ASCII byte. The guard is right and the new line is wrong.

  2. tests/test_inkling2_support.py::test_fastmodel_keeps_inkling2_eager_unless_told_otherwise fails wherever the file runs:

    assert re.search('if os\\.environ\\.get\\("UNSLOTH_COMPILE_DISABLE", "0"\\) == "0": ...', body)
    AssertionError: None
    

    It still pins the inline assignment that Inkling 2: partly disable compile through the shared helper #19073 replaced with the shared _set_partial_compile_disable() helper. CI does not show it yet: the file skips below transformers 5.24, and the HF=latest legs are held below 5.24. It fails locally on 5.24.0, so it would turn red as soon as that cap lifts.

Fix

Tests only, in tests/test_inkling2_support.py:

  • Both reads of checked-in source pass encoding = "utf-8":
    • the save.py read the guard flags;
    • the loader source read through __file__, which the guard does not see.
  • The eager-compile test now pins the current shape:
    • the Inkling 2 branch calls _set_partial_compile_disable();
    • the helper sets partial from unset, 0 or partial;
    • the helper keeps a full disable (1, true) as 1, so an explicit user choice is still left alone.

Verification

Check Result
test_source_read_encoding.py, main 1 failed
test_source_read_encoding.py, this branch 16 passed
test_inkling2_support.py, transformers 5.24.0, main 1 failed, 41 passed
test_inkling2_support.py, transformers 5.24.0, this branch 42 passed
test_inkling2_support.py, transformers 5.17 module skipped as before

Sabotage, each with only the product line changed:

  • Drop the helper call from the Inkling 2 branch in loader.py: the test fails on the call check.
  • Make the helper always set partial: the test fails with assert 'partial' == '1' for a full disable.

…le helper

test_source_read_encoding is red on main in the rest-2 shard: #19016
added a read of the checked-in unsloth/save.py without an encoding, which
breaks on Windows once that file gains a non-ASCII byte. Pass utf-8 there
and on the loader source read in the same file.

test_fastmodel_keeps_inkling2_eager_unless_told_otherwise still pinned
the inline UNSLOTH_COMPILE_DISABLE assignment that #19073 replaced with
_set_partial_compile_disable(), so it fails wherever the file runs
(transformers >= 5.24). Pin the helper call in the Inkling 2 branch and
the helper's behaviour instead: partial by default, a full disable kept.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T19:11:21.024879Z 4fbf04d 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. You're on a roll.

Reviewed commit: 4fbf04d58e

ℹ️ 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".

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.

1 participant