Skip to content

Validate TPU accelerate versions consistently - #4185

Open
lovettsendit wants to merge 3 commits into
huggingface:mainfrom
lovettsendit:fix/tpu-version-validation
Open

Validate TPU accelerate versions consistently#4185
lovettsendit wants to merge 3 commits into
huggingface:mainfrom
lovettsendit:fix/tpu-version-validation

Conversation

@lovettsendit

Copy link
Copy Markdown

What

Validate --accelerate_version with packaging.version.Version and convert invalid input into a clear, stable ValueError.

Why

Accelerate supports packaging>=20.0, but packaging.version.parse() handles invalid versions differently across supported releases:

  • Packaging 21.3 returns a legacy version object.
  • Packaging 22.0 and later raise InvalidVersion.

As a result, accelerate tpu-config currently accepts or rejects the same invalid value depending on the installed Packaging version.

Validation

  • Existing latest, dev, and explicit-version behavior remains unchanged.
  • Added a focused regression test for invalid versions.
  • Verified the proposed behavior under Packaging 21.3 and 22.0.
  • Breakcheck exercised 18/18 Packaging call sites with agent-authored fixtures, identified this changed call site, and verified that the repaired call behaves identically across both versions.

Discovered and reproduced with Breakcheck.

Replace parse with try-except for version validation.
Add test for invalid accelerate version installation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant