From f44c21965b20af7a06bc7b52e07d4eaa8ab50ac2 Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Wed, 2 Sep 2026 12:38:22 -0700 Subject: [PATCH 1/3] Keep the Cayley initialization on SO(3) in parametrizations tutorial 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 --- intermediate_source/parametrizations.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/intermediate_source/parametrizations.py b/intermediate_source/parametrizations.py index 59cff1d241c..bfd86e8b1e8 100644 --- a/intermediate_source/parametrizations.py +++ b/intermediate_source/parametrizations.py @@ -321,8 +321,15 @@ def right_inverse(self, A): print(torch.dist(layer_orthogonal.weight, X)) # layer_orthogonal.weight == X ############################################################################### -# This initialization step can be written more succinctly as -layer_orthogonal.weight = nn.init.orthogonal_(layer_orthogonal.weight) +# This initialization step can be written more succinctly by sampling straight +# into ``layer_orthogonal.weight``. The determinant correction is still needed: +# ``nn.init.orthogonal_`` samples from ``O(3)``, and when ``det(A) = -1`` the +# matrix has an eigenvalue at ``-1``, which makes the ``A + I`` that +# ``CayleyMap.right_inverse`` inverts singular. +X = nn.init.orthogonal_(layer_orthogonal.weight) +if X.det() < 0.: + X[0].neg_() +layer_orthogonal.weight = X ############################################################################### # The name of this method comes from the fact that we would often expect From e0f835661f2071bfac6f6cf12d4130c82b54692c Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Wed, 2 Sep 2026 12:50:12 -0700 Subject: [PATCH 2/3] Pin fastapi below 0.139.2 so ray serve can pickle the ASGI app 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 --- .ci/docker/requirements.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/docker/requirements.txt b/.ci/docker/requirements.txt index a1b0d6b5b37..547a72e9889 100644 --- a/.ci/docker/requirements.txt +++ b/.ci/docker/requirements.txt @@ -22,7 +22,10 @@ pytorch_sphinx_theme2==0.4.9 tqdm==4.66.1 numpy==1.24.4 pydantic>=2.10 -fastapi +# Pin fastapi: 0.139.2 made router route building thread-safe by adding an +# _effective_routes_lock (threading.Lock) to APIRouter, which ray[serve]'s +# @serve.ingress cannot cloudpickle. ray declares fastapi unbounded. +fastapi<0.139.2 matplotlib librosa torch==2.13 From 1d2ad9c6745e947e85fd7d5b582fadddeda02251 Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Wed, 2 Sep 2026 13:19:35 -0400 Subject: [PATCH 3/3] Pin katex to 0.18.4 to keep the docs image on Node 20 --- .ci/docker/common/install_docs_reqs.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/docker/common/install_docs_reqs.sh b/.ci/docker/common/install_docs_reqs.sh index 541c9976ad1..9617443200a 100644 --- a/.ci/docker/common/install_docs_reqs.sh +++ b/.ci/docker/common/install_docs_reqs.sh @@ -13,7 +13,9 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/source apt-get update apt-get install -y --no-install-recommends yarn -yarn global add katex --prefix /usr/local +# Pin katex: 0.18.5 switched to commander@^15, which requires Node >= 22.12 +# while this image installs Node 20, and yarn enforces engines strictly. +yarn global add katex@0.18.4 --prefix /usr/local sudo apt-get -y install doxygen