Unbreak tutorials CI: pin katex + fastapi, keep Cayley init on SO(3) - #3961
Merged
Conversation
nn.init.orthogonal_ samples from O(3), so det(A) is -1 about half the time.
For odd dimensions that forces an eigenvalue at -1, making the A + I that
CayleyMap.right_inverse inverts singular:
torch._C._LinAlgError: torch.linalg.solve: The solver failed because the
input matrix is singular.
The block a few lines above already corrects the determinant; the succinct
rewrite dropped it. Apply the same correction there.
Signed-off-by: Andrey Talman <atalman@users.noreply.github.com>
serving_tutorial.py fails when the docker image is rebuilt:
TypeError: Failed to serialize the ASGI app.:
!!! FAIL serialization: cannot pickle '_thread.lock' object
fastapi 0.139.2 refactored router route building to be thread-safe, adding
_effective_routes_lock (a threading.Lock) to APIRouter. ray[serve]'s
@serve.ingress cloudpickles the FastAPI app, and a lock cannot be pickled.
ray declares fastapi with no upper bound, and requirements.txt left it
unpinned, so any image rebuild picks up the break.
Signed-off-by: Andrey Talman <atalman@users.noreply.github.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3961
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit 1d2ad9c with merge base 212f15f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
huydhn
approved these changes
Sep 2, 2026
huydhn
left a comment
There was a problem hiding this comment.
The dep changes look good to me! I don't have the context on intermediate_source/parametrizations.py though, so maybe we need another approval.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Three fixes for the tutorials CI. Together with #3960 (merged) these clear every failure currently blocking #3959.
1. Docker image build -- pin katex to 0.18.4
Any PR that touches the docker context rebuilds the image, and the rebuild fails:
install_docs_reqs.shinstalls Node 20 and then runs an unpinnedyarn global add katex:^8.3.0^15.0.0commander@15.0.0declaresengines: { node: ">=22.12.0" }and yarn enforcesenginesstrictly. Pinned tokatex@0.18.4, the last release oncommander@^8.This is the same commit as in #3959 -- it is needed here too, because fix 2 below edits
requirements.txtand so triggers a rebuild. The longer-term fix is bumping the image fromsetup_20.xtosetup_22.x; worth a separate PR so the Node bump gets reviewed on its own blast radius.2.
serving_tutorial.py-- pin fastapi below 0.139.2fastapi 0.139.2 (2026-07-16) landed "Refactor router route building to make it thread-safe", adding to
fastapi/routing.py:@serve.ingress(app)cloudpickles the FastAPI app, and athreading.Lockis not picklable.raydeclaresfastapiwith no upper bound (fastapi; extra == "serve"), andrequirements.txtleft it unpinned, so any image rebuild picks it up. It does not reproduce onmaintoday only because that image was last built 2026-07-08, before the release.Bisected in a venv with
ray[serve]==2.55.0, reproducing the tutorial's@serve.deployment/@serve.ingress/@serve.batchstructure:The last row matters: starlette 1.6.0 is fine with fastapi 0.139.1, so despite the concurrent starlette 0.x -> 1.x major bump, starlette is not implicated and needs no pin.
A stopgap -- the real fix is upstream in ray, either excluding the lock from the pickled state or not pickling the app. Revisit when ray supports fastapi >= 0.139.2.
3.
parametrizations.py-- keep the Cayley initialization on SO(3)nn.init.orthogonal_samples fromO(3), notSO(3). For an odd dimension,det(A) = -1forces an eigenvalue at-1, soA + Iis exactly singular -- and that is the matrixCayleyMap.right_inverseinverts. The block a few lines above already corrects the determinant; the "more succinctly" rewrite dropped it. This applies the same correction there, and says why inline.200 trials with distinct seeds on torch 2.14.0+cpu, reproducing the tutorial's
SkewandCayleyMapverbatim:No seed is set anywhere in the file, which is why this surfaces as a flaky failure rather than a consistent one.
AI assistance (Claude) was used for this change.