Repository navigation
Docker publish: verify the Studio image env, and stop telling latest users to opt in to CPU - #11071
Conversation
…training, and stop telling latest users to opt in to CPU #10825 moved the Studio image from an image-wide UNSLOTH_ALLOW_CPU=1 to UNSLOTH_IMAGE_ALLOW_CPU=1 that the entrypoint translates per container. The unit tests pin the Dockerfile text; nothing checked the artifact, and the publish smoke-test job needs a GPU runner this repo does not have. build-studio now reads the pushed digest's config with imagetools and fails when UNSLOTH_ALLOW_CPU is in the env or the opt-in is missing. DOCKERHUB.md still told CPU-only users to pass -e UNSLOTH_ALLOW_CPU=1 to latest, which starts on CPU by itself since #10825; the example now shows latest plain and core with the opt-in. A test pins that Dockerfile.studio copies entrypoint.sh to the base's path and declares no ENTRYPOINT of its own.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17d7dbced6
ℹ️ 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".
| assert dest == ["/usr/local/bin/unsloth-entrypoint"], dest | ||
| assert re.findall(r"^COPY\s+entrypoint\.sh\s+(\S+)\s*$", studio, re.M) == dest | ||
| assert not re.search(r"^\s*ENTRYPOINT\b", studio, re.M), ( |
There was a problem hiding this comment.
Assert the base ENTRYPOINT directive
This compares only the COPY destination and never verifies the base Dockerfile's actual ENTRYPOINT. If a later base edit removes or redirects that directive while retaining the copy, this test still passes even though Dockerfile.studio declares no replacement, so the entrypoint that translates UNSLOTH_IMAGE_ALLOW_CPU would no longer run. Assert that the base contains the exact expected ENTRYPOINT target as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, the copy destination alone did not prove the base still runs that file. Fixed in c8c7782: the test now asserts the base declares ENTRYPOINT ["/usr/local/bin/unsloth-entrypoint"] exactly, so dropping or redirecting it fails here rather than silently leaving nothing to translate UNSLOTH_IMAGE_ALLOW_CPU.
The COPY destination alone does not prove the base still runs that file: a later base edit could drop or redirect ENTRYPOINT while keeping the copy, and the test would still pass even though nothing would translate UNSLOTH_IMAGE_ALLOW_CPU.
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…users to opt in to CPU (unslothai#11071) The Studio image turns UNSLOTH_IMAGE_ALLOW_CPU into UNSLOTH_ALLOW_CPU inside the entrypoint, so a plain image ENV of UNSLOTH_ALLOW_CPU would reach every process and disable training on a GPU host. Nothing checked that at publish time. - build-studio now inspects the pushed image with buildx imagetools and fails when UNSLOTH_ALLOW_CPU is present in the image env, or when UNSLOTH_IMAGE_ALLOW_CPU=1 is missing. - docker/DOCKERHUB.md no longer tells latest users to pass UNSLOTH_ALLOW_CPU=1; the image already defaults it, and the env table said as much, so the two contradicted each other. - tests/python/test_docker_cpu_fallback.py asserts the Studio image bundles its own entrypoint at the base's path, declares no ENTRYPOINT of its own, and that the base still runs that file.
Two follow-ups to #10825, which moved the Studio image off an image-wide
UNSLOTH_ALLOW_CPU=1and ontoUNSLOTH_IMAGE_ALLOW_CPU=1thatentrypoint.shtranslates per container.The artifact was never checked
An image-wide
UNSLOTH_ALLOW_CPUreaches every process in the container and turns off Unsloth's TRL trainer patches on GPU hosts, which is why #10825 moved away from it. The unit tests pin the Dockerfile text, and thesmoke-testjob that would catch it on the real artifact needs a self-hosted GPU runner. This repository has none:repos/unslothai/unsloth/actions/runnersreturnstotal_count: 0, so that job has never run and cannot.build-studionow reads the pushed digest's config withdocker buildx imagetools inspectand fails when the env carriesUNSLOTH_ALLOW_CPUor is missing theUNSLOTH_IMAGE_ALLOW_CPU=1opt-in. It needs no GPU and runs in the job that produced the digest.Checked against what is published today:
So the assertion passes on the current image and would have failed on the pre-#10825 one.
The Hub page contradicts itself
docker/DOCKERHUB.mdstill says "Without a GPU the container refuses to start unless you opt in" and showslatestbeing run with-e UNSLOTH_ALLOW_CPU=1, while its own environment table three sections later sayslatestalready starts without a GPU. Since #10825 the table is right and the paragraph is wrong. The paragraph now distinguishes the two images:lateststarts on a CPU-only host by itself,coreneeds the opt-in.This matters beyond tidiness: following the old example sets the variable image-wide on a machine that may well have a GPU, which is the exact configuration #10825 removed.
Also
A test pins that
Dockerfile.studiocopiesentrypoint.shto the base's path and declares noENTRYPOINTof its own, so the two images cannot drift apart again.Verification
tests/python/test_docker_cpu_fallback.py: 32 passed.actionlintreports the same 6 pre-existing findings as onmain.unsloth/unsloth:latestas shown above.