Pull requests / #2551

#2551 setup: cpu_info() reads a /proc/cpuinfo without a flags line as no AVX2, not a traceback (#1935)

open · @qiuzan2001 · 0 comentários · No GitHub

Setup & installWindowsLinux

Descrição

The product half of #1935 (the test half is #2552, separate so each can be taken alone).

**What it changes.** On Linux, `cpu_info()` in `setup.py` took the `flags` line's regex match without checking it.
aarch64's `/proc/cpuinfo` lists `Features` instead, and some emulated x86 containers list neither, so setup stopped
with `AttributeError: 'NoneType' object has no attribute 'group'` (a traceback on any Linux ARM host). A missing line
now means no flags (no AVX2, no AVX-512), the same way `cpu_floor()` already reads it (it catches `AttributeError`);
the CPU name is still read from `model name`.

**What it leaves alone.** A `/proc/cpuinfo` with a `flags` line (every x86 host this ran on before): the same flags,
AVX2/AVX-512 answer and name. Windows: untouched. What setup does next on an ARM host is unchanged by this PR: it
prints `CPU: <name> (no AVX2)`, `cpu_floor` says "unsupported", and setup stops with its existing message
("this CPU has neither AVX2 nor SSE4.2 ...") instead of a traceback. That message is about x86; making it name ARM
is left out.

**How it was checked.**
- New `tools/test_setup_oldcpu.py` `FloorTest.test_a_cpuinfo_without_flags_1935`: an aarch64 cpuinfo (`Features`)
  and an emulated one (no flags line) give `(name, False, False)` and floor "unsupported"; a flags line with avx2
  still gives `True`. On `main` it fails with the issue's `AttributeError`.
- `python3 tools/test_setup_oldcpu.py`: OK (1 Windows-only skip). `test_setup_choices.py`, `test_setup_amd.py`,
  `test_setup_stale_stamp.py`, `test_setup_unsloth.py`: OK.
- Python 3.14, Ubuntu (Linux 7.0), x86-64 (Ryzen 7 5800X3D); the ARM cpuinfo is a fixture, not an ARM machine.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

No site

Links install, modelos, releases.