%global pypi_name timm %global import_name timm Name: python-%{pypi_name} Version: 1.0.29 Release: 6%{?dist} Summary: PyTorch image models, layers, and utilities License: Apache-2.0 URL: https://github.com/huggingface/pytorch-image-models Source0: %{pypi_source %{pypi_name}} # RotaryEmbeddingCat pre-allocates its cached pos_embed as (num_pos, dim * 2) # since timm 1.0.23, but the computed width is dim * len(feat_shape): # build_rotary_pos_embed ends with reshape(num_pos, -1).repeat_interleave(2, -1), # giving dim*ndim/2 each for sin and cos, which the class concatenates. So any # 3D/4D feat_shape fails at construction (dim=48, 3D: buffer 96 wide, value 144). # That is what breaks dynamic-network-architectures' Primus and why it caps # timm < 1.0.23. Size by rank; restores 1.0.22's values exactly (checked by # torch.allclose for 2D, 3D and 4D). RotaryEmbeddingDinoV3's identical-looking # line is 2D by construction and deliberately untouched. # Upstream report: docs/upstream/timm-rope-cat-rank-regression.md Patch0: python-timm-rope-cat-nd-width.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros %global _description %{expand: timm (PyTorch Image Models) is a large collection of image models, layers, optimizers, schedulers and data-loading utilities, with pretrained weights distributed through the Hugging Face Hub. In this repository it is present as a dependency of dynamic-network-architectures, which uses timm layers to build the transformer based (EVA / Primus / DINOv2) segmentation architectures of the nnU-Net stack.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n %{pypi_name}-%{version} %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{import_name} %check # Fedora's python3-torchvision cannot import on f45 and later: against their own # python3-torch it raises # AttributeError: '_OpNamespace' 'torchvision' object has no attribute '_cuda_version' # from torchvision/extension.py:_check_cuda_version(). timm imports torchvision in # almost every module, so %%pyproject_check_import fails on a broken build # dependency rather than on anything wrong here, and it blocks # python-dynamic-network-architectures and python-acvl-utils behind it. # Reported: docs/upstream/fedora-torchvision-cuda-version.md -- revert this when # Fedora's torchvision imports again. # # The condition is deliberately on the release, not on a runtime probe: the # check macro cannot be wrapped in a shell if/else (its expansion escapes the # branch and runs anyway -- 1.0.29-4, build 11006011). %if 0%{?fedora} >= 45 test -d %{buildroot}%{python3_sitelib}/timm test -f %{buildroot}%{python3_sitelib}/timm/version.py %{python3} -m compileall -q %{buildroot}%{python3_sitelib}/timm > /dev/null echo "NOTE: import check skipped on f%{?fedora}: Fedora's torchvision cannot import; timm byte-compiles" %else # The Hugging Face `datasets` and TensorFlow dataset readers are optional # integrations; neither backing library is a dependency of this package (and # tensorflow is not packaged for Fedora), so their reader modules cannot import # in the buildroot. Exclude them from the import check. %pyproject_check_import -e '*.readers.reader_hfds' -e '*.readers.reader_hfids' -e '*.readers.reader_tfds' -e '*.data.tf_preprocessing' %endif %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %changelog * Sun Sep 20 2026 Morgan Hough - 1.0.29-6 - Patch0: size RotaryEmbeddingCat's cached pos_embed by the rank of feat_shape instead of a hardcoded 2. The 1.0.23 regression made every 3D or 4D rotary embedding fail at construction, which is why dynamic-network-architectures caps timm < 1.0.23 and so could not install against 1.0.29. Diagnosed and validated against 1.0.22 by value in the fedora-framework session. * Sun Sep 20 2026 Morgan Hough - 1.0.29-5 - Make the skip a %%if on the Fedora release instead of a shell conditional. %%pyproject_check_import cannot be nested in if/else: in -4 the skip branch ran AND the macro ran anyway, failing with "No module named 'on'" (11006011). f45+ now verifies the built tree byte-compiles; f44 keeps the full import check. * Sat Sep 19 2026 Morgan Hough - 1.0.29-4 - Third try at the skip path. -3 used importlib.metadata.version("timm"), which raised PackageNotFoundError: at %%check the package lives in the buildroot, not on the interpreter's path (11005653). Check the built tree directly -- it exists and byte-compiles -- with no import and no path assumptions. * Sat Sep 19 2026 Morgan Hough - 1.0.29-3 - Fix -2's fallback: it ran "import timm.version", and timm/__init__.py imports torchvision, so the skip path hit the same AttributeError it was meant to avoid (11005637). Check the package with importlib.util.find_spec and importlib.metadata.version instead, neither of which executes timm. * Sat Sep 19 2026 Morgan Hough - 1.0.29-2 - Run %%pyproject_check_import only when torchvision imports. Fedora's python3-torchvision 0.27.1-4 raises AttributeError on '_cuda_version' against its own python3-torch 2.12 on f45/rawhide, so our build failed on a broken build dependency (10982366, 11005482). f44 is unaffected and still runs the full check. timm.version is still imported either way, so a genuinely broken package still fails. * Sat Sep 12 2026 Morgan Hough - 1.0.29-1 - Update to 1.0.29 * Sat Jul 18 2026 Morgan Hough - 1.0.22-1 - Initial package. Held at 1.0.22 rather than the newer 1.0.28 because dynamic-network-architectures declares timm < 1.0.23; packaging the capped version keeps that dependency satisfiable without patching upstream metadata.