Skip to content

Docker ROCm image: ship Unsloth Studio, as the CUDA image already does - #11218

Merged
danielhanchen merged 13 commits into
unslothai:mainfrom
LeoBorcherding:feat/rocm-docker-studio-image
Sep 20, 2026
Merged

danielhanchen merged 13 commits into
unslothai:mainfrom
LeoBorcherding:feat/rocm-docker-studio-image

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

unsloth/unsloth-rocm is training-only. The CUDA image gets Studio on :8000 via docker/Dockerfile.studio; the ROCm image has no equivalent, so an AMD user in Docker gets a Python prompt where an NVIDIA user gets a UI.

$ docker run --rm --entrypoint bash unsloth/unsloth-rocm -lc "unsloth studio -p 8899"
Unsloth Studio not set up. Run install.sh first.

Changes

One new file, docker/Dockerfile.studio-rocm, layering Studio on the ROCm base. Kept separate from Dockerfile.studio because that file bakes a CUDA llama.cpp, stages NVRTC and dedups nvidia-* wheels, none of which mean anything on ROCm.

  • torch index comes from /etc/unsloth-rocm-build, written by the base with the index it resolved against. Letting install.sh detect would land on CPU wheels, since the builder has no GPU.
  • build fails unless the Studio venv and base venv torch agree on the ROCm leaf, so the image can't ship two runtimes.
  • build fails unless studio/frontend/dist/index.html exists, so a missing UI build is caught at build time, not as a 404.
  • llama.cpp is the CPU bundle: a ROCm bundle is per-gfx-family and would pin the image to one arch.

No JupyterLab, sshd or supervisord, unlike unsloth/unsloth:studio (#11235).

Verification

R9700 (gfx1201), Windows 11 26200, WSL2 Ubuntu 24.04, /dev/dxg only, host ROCm 7.2.1, BASE_IMAGE=unsloth/unsloth-rocm:latest.

check result
build image built, both asserts passed
GET / and /api/health 200
Studio hardware detection ROCm (HIP 7.2.26015) -- AMD Radeon AI PRO R9700
Studio venv torch 2.11.0+rocm7.2, cuda.is_available() True

Run with UNSLOTH_SKIP_GPU_CHECK=1, since the published base predates #11212 and still gates on /dev/kfd.

Not verified: any non-WSL host, a training run through the UI, GGUF chat, multi-GPU, per-arch ROCM_GFX= base.

@LeoBorcherding LeoBorcherding 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.

Codex review, relayed from a mirror

Codex does not answer on this repository, so the commits on this pull request were replayed onto LeoBorcherding/unsloth-staging-review#5 and reviewed there. Reviewed commit 6fca120f04 on the mirror, which is this PR's fd99c8647 replayed onto main 14b40739a.

2 findings, in Codex's words, inline below where the line is on this diff.

Comment thread docker/Dockerfile.studio-rocm Resolved
Comment thread docker/Dockerfile.studio-rocm Resolved
…its header a launch line that works

The workflow built only Dockerfile.rocm, so Dockerfile.studio-rocm was never
published and the comment saying CI pins its refs described a job that did not
exist. build-studio now layers it on the base this run pushed, by digest and
with the same UNSLOTH_REF / zoo ref, and tag-studio gives it every base tag
with a -studio leaf under the same gates (:studio beside :latest). The Hub
page syncs once both moved and documents the tag.

The header pointed WSL2 users at `docker/run.sh --rocm`, which has no DXG path
on main (that is unslothai#11212), picks :latest, and publishes no port; the by-hand
line passed group names, which the image cannot resolve. Both lines now say
what actually works, and WSL2 is named as waiting on unslothai#11212.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Pushed efba222 (after merging main at df18fa7).

docker/Dockerfile.studio-rocm was never built by CI: docker-publish-rocm.yml only ran Dockerfile.rocm, so nothing published Studio and the comment claiming CI pinned its refs described a job that did not exist. The workflow now has a build-studio job that layers it on the base this run pushed, by digest and with the same UNSLOTH_REF / zoo ref the base baked, and a tag-studio job that gives it every base tag with a -studio leaf under the same gates (:studio beside :latest, nightly-studio, gfx1151-studio, sha-<commit>-studio). It also asserts the pushed image's env carries no UNSLOTH_ALLOW_CPU, as the CUDA workflow does. The Hub page sync waits on both tags and docker/DOCKERHUB-ROCM.md documents the tag. Test added in tests/python/test_docker_rocm.py.

The header's run lines could not start the image as written: docker/run.sh --rocm has no DXG path on main (that is #11212), defaults to :latest and publishes no port, and the by-hand line passed --group-add video, a name the image cannot resolve. Both lines now say what works on Linux, and Windows/WSL2 is named as waiting on #11212, with the by-hand /dev/dxg + UNSLOTH_SKIP_GPU_CHECK=1 invocation until then.

Not run: the workflow itself. No image was rebuilt, since the Dockerfile change is comments only.

@LeoBorcherding LeoBorcherding 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.

Codex findings, via a mirror

Codex does not answer on this repository, so it ran against a copy of this pull request's commits at LeoBorcherding/unsloth-staging-review#5. It looked at 288f47c6eb there, which is this PR's 53fd8c943 replayed onto main 9f76c5a3e. Nothing was reviewed or resolved on the copy: the findings are here, in Codex's words, to be worked through on this pull request.

2 findings, inline below where the line is on this diff.

Comment thread docker/Dockerfile.studio-rocm Resolved
@LeoBorcherding

LeoBorcherding commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Pushed 83f8b8cf8f.

Restart with UNSLOTH_STUDIO_PASSWORD set. The old CMD passed the variable to Studio on every start. It only sets the first password, and Studio exits 1 if it sees one after that, so a docker restart never came back up. The CMD is now a small launcher that does what the CUDA image does: write the password to a root-only file, and let studio_run.sh hand it to Studio on first boot only. Verified against the real studio_run.sh: first boot gets the password, a restart with the variable still set does not. The unused studio_password.sh copy is removed.

gfx906. install.sh only leaves bitsandbytes out of a gfx906 install when told the arch, and the builder has no GPU to probe. The base's ROCM_GFX is now forwarded, and the build fails if a gfx906 Studio venv ends up with bitsandbytes. This does not change torch routing: the index is pinned, which skips the reroute.

Tag order. Base tags used to move before Studio built, so :latest and :studio could come from different runs. Now both images build first, then one job tags both, back to back. The separate tag-studio job is gone.

5 tests added, 43 pass. Not run: a gfx906 base.

Built the image at this commit on the published unsloth/unsloth-rocm:latest (R9700, WSL2, DXG bridge, UNSLOTH_SKIP_GPU_CHECK=1), then ran it with UNSLOTH_STUDIO_PASSWORD set and a named volume:

first boot:               /api/health 200 after ~8s   (password from UNSLOTH_STUDIO_PASSWORD env)
docker restart, env set:  /api/health 200 after ~8s   (password set on an earlier boot)
old CMD, same volume:     Error: an Unsloth admin password is already set ...   exit 1

The red check on this head, test_video_step_cache_auto_toggles_on_actual_steps, also fails on main at 14b4073, 6e262b1 and df18fa7.

…, tell install.sh the gfx, and move no stable tag before both builds exist

The CMD handed Studio UNSLOTH_STUDIO_PASSWORD on every start. It only sets the
first admin password and `unsloth studio` exits 1 when given one after that, so
a `docker restart` with the variable still set (a Compose file) never came back
up. studio_launch_rocm.sh is now the CMD: as the CUDA launcher does, it writes
the value to a root-only file that studio_run.sh hands over only while no
password is stored, and drops it from Studio's environment. The copied
studio_password.sh went, since nothing ran it and it waits on JupyterLab.

install.sh only skips bitsandbytes on gfx906 when told the arch, and the
GPU-less builder cannot probe it, so a gfx906-studio image would have shipped a
4-bit backend with no kernels. The base's ROCM_GFX is forwarded as
UNSLOTH_ROCM_GFX_ARCH, and the build asserts a gfx906 Studio venv has no
bitsandbytes.

The base tags moved before build-studio ran, so a Studio failure or a second
overlapping run could leave :latest and :studio from different builds. Both
digests are now built first, and the tag job creates both manifests back to
back; tag-studio and its job-scheduling gap are gone.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Pushed 3d29d39. The Hub page said every tag has a -studio twin, which would send someone to latest-studio; the twin of latest is studio, so the row now names the twins that exist and says so. Docs only.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author
image

danielhanchen and others added 5 commits September 20, 2026 09:26
The workflow concurrency group carries github.run_id on main, deliberately, so a
dispatch runs alongside the cron instead of discarding it. That was harmless
while one stable tag moved. This workflow now promotes two, and
DOCKERHUB-ROCM.md documents them as a pair: `studio` is the Studio twin of
`latest`.

Unserialized, two runs interleave: A writes latest, B writes latest and studio,
A writes studio, and the pair stays sourced from different builds until the next
run. Reachable rather than theoretical, since the cadence is a weekly cron plus
dispatch and a ROCm run takes hours.

The tag job gets its own group with no run_id, so stable promotion queues across
runs. cancel-in-progress stays false: a cancelled promotion is the split this
exists to prevent.

The existing test comment claimed one job "back to back" was enough for another
run not to land between the two writes. That is true within a run and not across
runs, so it is corrected rather than left to reassure the next reader.

Negative control: with the test present and the concurrency block reverted,
test_stable_tag_promotion_is_serialized_across_runs fails (1 failed, 44 passed);
with the fix, 45 pass.
# Conflicts:
#	tests/python/test_docker_rocm.py
6f19113 added a shared concurrency group to the tag job to stop two runs
splitting the latest/studio pair. That trades a small window for a bigger loss:
GitHub concurrency is not a queue. A shared group holds one running job and one
pending job, and a third arrival cancels the pending one, which this repo has
already written down twice in
tests/studio/test_main_runs_survive_merge_bursts.py ("any existing pending job
or workflow in the same concurrency group will be canceled"). For an override
build the tag job is the only step that writes the run's SHA tags, so a
cancelled one leaves two pushed digests with no tags at all.

The pairing window itself is not this workflow's to close. docker-publish.yml
promotes latest and core from the same per-run group with no job-level group, so
the shape is repo-wide and accepted; closing it needs a real lock that preserves
every arrival, not concurrency, and that belongs in its own change against both
workflows.

The test comment stays corrected, because the claim that started this ("one job,
back to back, so another run cannot land between them") is true within a run and
false across runs, and it is what hid the window. It now says what is actually
true, including why the obvious fix is worse.
@danielhanchen

Copy link
Copy Markdown
Member

Review record for #11218, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#25.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1 — reviewed mirror c8aeea98e (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on .github/workflows/docker-publish-rocm.yml (on the mirror)

@@ -314,6 +390,41 @@ jobs:
               docker buildx imagetools inspect "$tag"
           done
 
+      # The same rules with a -studio leaf, in this job and right after the base's:
+      # a second job could be scheduled with another run's tag job in between, and
+      # the twins would then come from different builds. format(), not a bare
+      # ${{ }}-studio: the raw gfx line above is matched by name in
+      # tests/python/test_docker_rocm.py and must stay unique.
+      - name: Resolve Studio tags
+        id: meta_studio
+        uses: docker/metadata-action@v6
+        with:
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+          tags: |
+            type=raw,value=studio,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && needs.prepare.outputs.stable == 'true' }}
+            type=ref,event=tag,suffix=-studio,enable=${{ needs.prepare.outputs.stable == 'true' }}
+            type=schedule,pattern=nightly-studio,enable=${{ needs.prepare.outputs.stable == 'true' }}
+            type=raw,value=${{ format('{0}-studio', needs.prepare.outputs.rocm_gfx) }},enable=${{ needs.prepare.outputs.gfx_tag == 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
+            type=sha,prefix=sha-,format=short,suffix=${{ needs.prepare.outputs.rocm_gfx != '' && format('-{0}', needs.prepare.outputs.rocm_gfx) || '' }}${{ needs.prepare.outputs.stable != 'true' && format('-r{0}', github.run_id) || '' }}-studio
+
+      - name: Create Studio manifest
+        env:
+          DIGEST: ${{ needs.build-studio.outputs.digest }}
+          TAGS_JSON: ${{ steps.meta_studio.outputs.json }}
+        run: |
+          TAG_FLAGS=()
+          while IFS= read -r t; do TAG_FLAGS+=(-t "$t"); done < <(jq -r '.tags[]' <<<"$TAGS_JSON")
+          docker buildx imagetools create "${TAG_FLAGS[@]}" "${REGISTRY}/${IMAGE_NAME}@${DIGEST}"

P1 Badge Serialize stable tag promotion across workflow runs

When a scheduled run and a workflow_dispatch run overlap on the default branch, the workflow-level concurrency group includes github.run_id, so both tag jobs may execute simultaneously. These separate manifest writes can interleave—for example, run A writes latest, run B writes latest and studio, then run A writes studio—leaving the two stable tags permanently sourced from different runs, contrary to the documented pairing. Keeping both writes in one job only orders them within that run; stable promotion needs serialization across runs or another atomic/locked mechanism.

Useful? React with 👍 / 👎.

Accepted on the mirror

Reply from danielhanchen:

Confirmed and fixed in 6f19113 on the source PR. The workflow group is docker-publish-rocm-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.run_id || '' }}, so on main each run is alone in its group by design, and this PR is what makes that matter: it promotes a second stable tag that DOCKERHUB-ROCM.md documents as the twin of latest. The tag job now carries its own group, docker-publish-rocm-stable-tags-${{ github.ref }}, with no run_id so promotion queues across runs, and cancel-in-progress false because a cancelled promotion is the split it prevents. Added test_stable_tag_promotion_is_serialized_across_runs; with the concurrency block reverted and the test kept it fails, 1 failed 44 passed, and 45 pass with the fix. Also corrected the existing comment that said one job back to back was enough: that orders the two writes within a run, not across runs.

Round 2 — reviewed mirror c8aeea98e (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: c8aeea98e9

View security finding report

Only the user who started this review can view the report in Codex.

No triage reaction was recorded on the mirror

Round 3 — reviewed mirror d47c77fb6 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on .github/workflows/docker-publish-rocm.yml (on the mirror)

@@ -267,10 +269,94 @@ jobs:
             UNSLOTH_REF=${{ needs.prepare.outputs.unsloth_ref }}
             UNSLOTH_ZOO_REF=${{ needs.prepare.outputs.zoo_ref }}
 
+  # Studio on the base this run pushed (docker/Dockerfile.studio-rocm), the ROCm
+  # half of docker-publish.yml's build-studio. The base by DIGEST, not by tag:
+  # :latest can already be a newer run's by the time this job starts. The Studio
+  # refs are the ones the base baked, so both venvs run the same commit even if
+  # upstream moved mid-run. Before tag: no stable tag moves until both digests
+  # exist, so :latest and :studio always come from one run (unlike the CUDA
+  # workflow, where :core moves before its Studio build starts).
+  build-studio:
+    needs: [prepare, build]
+    runs-on: ubuntu-latest
+    timeout-minutes: 150
+    outputs:
+      digest: ${{ steps.build.outputs.digest }}
+    steps:
+      - uses: actions/checkout@v7
+
+      # The 21GB base is pulled onto the runner and Studio adds a second torch on
+      # top, so this clears more than the base build does.
+      - name: Reclaim disk
+        run: |
+          sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
+                      /opt/hostedtoolcache "$AGENT_TOOLSDIRECTORY" \
+                      /usr/local/.ghcup /usr/share/swift \
+                      /usr/local/share/powershell /usr/local/lib/node_modules \
+                      /usr/local/julia* /opt/microsoft /usr/share/miniconda \
+                      /opt/az /usr/local/share/boost /usr/local/share/chromium || true
+          sudo docker image prune -af >/dev/null 2>&1 || true
+          df -h /
+
+      - uses: docker/setup-buildx-action@v3
+
+      - name: Log in to Docker Hub
+        uses: docker/login-action@v4
+        with:
+          username: ${{ env.REGISTRY_USERNAME }}
+          password: ${{ secrets.DOCKER_API_KEY }}
+
+      - name: Resolve labels
+        id: meta
+        uses: docker/metadata-action@v6
+        with:
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+          # This one ships Studio itself, which is AGPL-3.0.
+          labels: |
+            org.opencontainers.image.licenses=Apache-2.0 AND AGPL-3.0-only
+
+      - name: Build and push (by digest)
+        id: build
+        uses: docker/build-push-action@v6
+        with:
+          context: ./docker
+          file: ./docker/Dockerfile.studio-rocm
+          platforms: linux/amd64
+          labels: ${{ steps.meta.outputs.labels }}
+          # No cache-from / cache-to, for the reason the base build gives.
+          outputs:    type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
+          build-args: |
+            BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}
+            UNSLOTH_STUDIO_REF=${{ needs.prepare.outputs.unsloth_ref }}
+            UNSLOTH_STUDIO_ZOO_REF=${{ needs.prepare.outputs.zoo_ref }}
+
+      # The Dockerfile hands install.sh UNSLOTH_ALLOW_CPU=1 for the GPU-less build
+      # only. Image-wide it would reach every process and turn off Unsloth's TRL
+      # trainer patches on GPU hosts (#10825), so check the artifact the registry
+      # serves rather than the Dockerfile text, as docker-publish.yml does.
+      - name: Assert the Studio image env cannot disable training
+        run: |
+          REF='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}'
+          ENV_JSON="$(docker buildx imagetools inspect "$REF" --format '{{json .Image}}' \
+                      | jq -c '[.. | objects | select(has("config")) | .config.Env // []] | add')"
+          echo "$ENV_JSON" | jq -r '.[] | select(startswith("UNSLOTH_"))'
+          echo "$ENV_JSON" | jq -e 'map(select(startswith("UNSLOTH_ALLOW_CPU="))) | length == 0' >/dev/null \
+            || { echo "::error::Studio image env carries UNSLOTH_ALLOW_CPU, which disables Unsloth's TRL patches on GPU hosts"; exit 1; }
+
   # Attach human-readable tags to the digest pushed above.
   tag:
     runs-on: ubuntu-latest
-    needs: [prepare, build]
+    needs: [prepare, build, build-studio]
+    # The workflow group above deliberately carries github.run_id on main, so a dispatch runs
+    # alongside the cron instead of cancelling it. That was harmless while one stable tag moved;
+    # this run now promotes two that DOCKERHUB-ROCM.md documents as a pair (`studio` is the
+    # Studio twin of `latest`). Unserialized, two runs interleave -- A writes latest, B writes
+    # latest and studio, A writes studio -- and the pair is left sourced from different builds
+    # until the next run. This group has no run_id, so stable promotion queues across runs;
+    # cancel-in-progress stays false because a cancelled promotion is the split it prevents.
+    concurrency:
+      group: docker-publish-rocm-stable-tags-${{ github.ref }}
+      cancel-in-progress: false

P2 Badge Preserve every pending tag promotion

When three runs for the same ref finish building close together, this shared job-level concurrency group allows only one running and one pending tag job, so the third arrival cancels the second even though cancel-in-progress is false. This behavior is explicitly documented in tests/studio/test_main_runs_survive_merge_bursts.py:6-9: “any existing pending job or workflow in the same concurrency group will be canceled.” For override builds, that canceled job is the only step creating the run-specific SHA tags, leaving both successfully pushed digests untagged; use a serialization mechanism that preserves every arrival rather than treating GitHub concurrency as a queue.

Useful? React with 👍 / 👎.

Accepted on the mirror

Reply from danielhanchen:

Correct, and it makes my own fix the worse trade. I reverted it in c09a438. GitHub concurrency is not a queue: a shared group holds one running and one pending job and a third arrival cancels the pending one, which this repo already wrote down in tests/studio/test_main_runs_survive_merge_bursts.py after two incidents. For an override build the tag job is the only step writing that run's SHA tags, so a cancelled one leaves two pushed digests with no tags at all, which is worse than the split I was closing. On the original item: the pairing window is not this workflow's to close either. docker-publish.yml promotes latest and core from the same per-run group with no job-level group, so the shape is repo-wide and accepted, and closing it needs a lock that preserves every arrival rather than concurrency, against both workflows in its own change. What stays from the round is the corrected comment: 'one job, back to back' orders the two writes within a run and not across runs, and it now also records why the obvious fix is wrong.

Round 4 — reviewed mirror 1f96cf657 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 1f96cf657a

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 1f96cf657 (no equivalent commit found on this PR).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

@danielhanchen
danielhanchen merged commit e259903 into unslothai:main Sep 20, 2026
20 checks passed
danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Sep 21, 2026
…ion of it

This branch is stacked on unslothai#11218, which has since been squash-merged, so main
and the branch carry the same work under different SHAs and three files
conflicted: the ROCm publish workflow, the Hub page and Dockerfile.studio-rocm.
No commit on main has touched any of them since that merge, so the branch side
is the later revision in each case and is kept.

Two places needed more than "keep ours":

The Hub page. The branch predates unslothai#11212, so taking its copy wholesale silently
reverted the WSL2 section that PR added: the /dev/dxg flags, the librocdxg
mount and the per-architecture build note. Rebuilt from main instead, with only
this branch's three real additions applied (the studio tag row, the studio
paragraph, and 8888 in the run command). test_the_hub_page_gives_the_same_wsl_
flags_as_run_sh caught the revert.

Two tests in test_docker_rocm.py still pinned unslothai#11218's shape, which this PR
deliberately replaces:

- the image now runs the shared studio_launch.sh under supervisord rather than
  the single-service studio_launch_rocm.sh, so the assertion follows the
  Dockerfile, and the supervisord program list is covered by the new suite.
- the auto-merge left TWO copies of the publish test, the branch's updated one
  and main's older one, which asserts `"tag-studio" not in wf["jobs"]`. That is
  exactly the job this PR adds, so the stale copy is removed rather than the
  survivor weakened.

778 docker tests pass, 2 skipped.
danielhanchen pushed a commit that referenced this pull request Sep 21, 2026
…CUDA image does (#11286)

The ROCm Studio image from #11218 runs Studio alone, so an AMD user who follows the
Docker quickstart has nowhere to open a notebook. The CUDA core image already carries
JupyterLab, the notebook tooling and the notebooks, which Dockerfile.studio inherits;
the ROCm base carries none of it, so Dockerfile.studio-rocm installs it itself, piece
by piece against the CUDA files, with a suite pinning the two together.

supervisord and studio_launch.sh are not new here: both are already on main driving the
CUDA Studio image, and this points the ROCm image at them rather than adding a second
way to run two services in one container.

An earlier revision also enabled key-only sshd on :22. That rode along with the
notebooks and had no argument of its own, so it was stripped: openssh-server is not
installed, EXPOSE is 8000 8888, and studio_launch.sh's existing `command -v sshd` gate
keeps the shared supervisord program down.

The org Actions queue is 200+ runs deep, so this PR's own checks never reported. Run on
staging instead: 70 passed on ubuntu-latest and on macos-15, and the full repo suite at
8034 + 11465 passed. Eight failures there, seven of which reproduce on a clean
origin/main worktree and one of which pre-commit.ci fixed on the branch. The
windows-latest leg errors on an unguarded os.geteuid() that has been in
tests/python/test_docker_rocm.py since #10820, byte-identical on main; fixed separately
in #11457.

Not verified: the GPU. The author's run went through Docker Desktop's /dev/dxg, where
the torch wheel's bundled HSA runtime has no DXG path, so torch.cuda.is_available() was
False and no notebook in this image has trained.

Closes #11235
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
unslothai#11218)

* Docker ROCm image: ship Unsloth Studio, as the CUDA image already does

* Assert the base ROCm leaf, not the exact torch version, in the Studio venv

* Publish the ROCm Studio image from docker-publish-rocm.yml, and give its header a launch line that works

The workflow built only Dockerfile.rocm, so Dockerfile.studio-rocm was never
published and the comment saying CI pins its refs described a job that did not
exist. build-studio now layers it on the base this run pushed, by digest and
with the same UNSLOTH_REF / zoo ref, and tag-studio gives it every base tag
with a -studio leaf under the same gates (:studio beside :latest). The Hub
page syncs once both moved and documents the tag.

The header pointed WSL2 users at `docker/run.sh --rocm`, which has no DXG path
on main (that is unslothai#11212), picks :latest, and publishes no port; the by-hand
line passed group names, which the image cannot resolve. Both lines now say
what actually works, and WSL2 is named as waiting on unslothai#11212.

* ROCm Studio image: survive a restart with UNSLOTH_STUDIO_PASSWORD set, tell install.sh the gfx, and move no stable tag before both builds exist

The CMD handed Studio UNSLOTH_STUDIO_PASSWORD on every start. It only sets the
first admin password and `unsloth studio` exits 1 when given one after that, so
a `docker restart` with the variable still set (a Compose file) never came back
up. studio_launch_rocm.sh is now the CMD: as the CUDA launcher does, it writes
the value to a root-only file that studio_run.sh hands over only while no
password is stored, and drops it from Studio's environment. The copied
studio_password.sh went, since nothing ran it and it waits on JupyterLab.

install.sh only skips bitsandbytes on gfx906 when told the arch, and the
GPU-less builder cannot probe it, so a gfx906-studio image would have shipped a
4-bit backend with no kernels. The base's ROCM_GFX is forwarded as
UNSLOTH_ROCM_GFX_ARCH, and the build asserts a gfx906 Studio venv has no
bitsandbytes.

The base tags moved before build-studio ran, so a Studio failure or a second
overlapping run could leave :latest and :studio from different builds. Both
digests are now built first, and the tag job creates both manifests back to
back; tag-studio and its job-scheduling gap are gone.

* Hub page: name the -studio twins, since latest's is :studio and not latest-studio

* Serialize stable tag promotion, so latest and studio cannot split

The workflow concurrency group carries github.run_id on main, deliberately, so a
dispatch runs alongside the cron instead of discarding it. That was harmless
while one stable tag moved. This workflow now promotes two, and
DOCKERHUB-ROCM.md documents them as a pair: `studio` is the Studio twin of
`latest`.

Unserialized, two runs interleave: A writes latest, B writes latest and studio,
A writes studio, and the pair stays sourced from different builds until the next
run. Reachable rather than theoretical, since the cadence is a weekly cron plus
dispatch and a ROCm run takes hours.

The tag job gets its own group with no run_id, so stable promotion queues across
runs. cancel-in-progress stays false: a cancelled promotion is the split this
exists to prevent.

The existing test comment claimed one job "back to back" was enough for another
run not to land between the two writes. That is true within a run and not across
runs, so it is corrected rather than left to reassure the next reader.

Negative control: with the test present and the concurrency block reverted,
test_stable_tag_promotion_is_serialized_across_runs fails (1 failed, 44 passed);
with the fix, 45 pass.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Revert the job-level concurrency group; it loses whole runs

6f19113 added a shared concurrency group to the tag job to stop two runs
splitting the latest/studio pair. That trades a small window for a bigger loss:
GitHub concurrency is not a queue. A shared group holds one running job and one
pending job, and a third arrival cancels the pending one, which this repo has
already written down twice in
tests/studio/test_main_runs_survive_merge_bursts.py ("any existing pending job
or workflow in the same concurrency group will be canceled"). For an override
build the tag job is the only step that writes the run's SHA tags, so a
cancelled one leaves two pushed digests with no tags at all.

The pairing window itself is not this workflow's to close. docker-publish.yml
promotes latest and core from the same per-run group with no job-level group, so
the shape is repo-wide and accepted; closing it needs a real lock that preserves
every arrival, not concurrency, and that belongs in its own change against both
workflows.

The test comment stays corrected, because the claim that started this ("one job,
back to back, so another run cannot land between them") is true within a run and
false across runs, and it is what hid the window. It now says what is actually
true, including why the obvious fix is worse.

---------

Co-authored-by: Daniel Han <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…CUDA image does (unslothai#11286)

The ROCm Studio image from unslothai#11218 runs Studio alone, so an AMD user who follows the
Docker quickstart has nowhere to open a notebook. The CUDA core image already carries
JupyterLab, the notebook tooling and the notebooks, which Dockerfile.studio inherits;
the ROCm base carries none of it, so Dockerfile.studio-rocm installs it itself, piece
by piece against the CUDA files, with a suite pinning the two together.

supervisord and studio_launch.sh are not new here: both are already on main driving the
CUDA Studio image, and this points the ROCm image at them rather than adding a second
way to run two services in one container.

An earlier revision also enabled key-only sshd on :22. That rode along with the
notebooks and had no argument of its own, so it was stripped: openssh-server is not
installed, EXPOSE is 8000 8888, and studio_launch.sh's existing `command -v sshd` gate
keeps the shared supervisord program down.

The org Actions queue is 200+ runs deep, so this PR's own checks never reported. Run on
staging instead: 70 passed on ubuntu-latest and on macos-15, and the full repo suite at
8034 + 11465 passed. Eight failures there, seven of which reproduce on a clean
origin/main worktree and one of which pre-commit.ci fixed on the branch. The
windows-latest leg errors on an unguarded os.geteuid() that has been in
tests/python/test_docker_rocm.py since unslothai#10820, byte-identical on main; fixed separately
in unslothai#11457.

Not verified: the GPU. The author's run went through Docker Desktop's /dev/dxg, where
the torch wheel's bundled HSA runtime has no DXG path, so torch.cuda.is_available() was
False and no notebook in this image has trained.

Closes unslothai#11235
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