Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pytorch 2.13 is released , updating transformer to handle the fix tf32 issue#47222

Open
khushali9 wants to merge 3 commits into
huggingface:mainfrom
khushali9:tf32Pytorch2.13
Open

pytorch 2.13 is released , updating transformer to handle the fix tf32 issue#47222
khushali9 wants to merge 3 commits into
huggingface:mainfrom
khushali9:tf32Pytorch2.13

Conversation

@khushali9

@khushali9 khushali9 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Removing it again after 2.13 Pytorch release. @ydshieh Also I kept version check such that it does not break for pytorch <2.13.

This fix is no longer needed after issue#1 fixed by my on Pytorch
issue#2 does not need to be fixed, as we have so many ways to avoid it.

Basically dont use hasattr when you have already set fp32_precision generic/globally.

Fixes # (issue)

Code Agent Policy

The Transformers repo is currently being overwhelmed by a large number of PRs and issue comments written by
code agents. These often are low-quality, or fix extremely minor issues that occur rarely or never in practice.
As a result, we're instituting a rule that first-time contributors should not use code agents to submit PRs or issues.
We'd also ask autonomous "OpenClaw"-like agents not to open any PRs or issues.

Issues/PRs from first-time contributors that violate this rule will probably just be closed without review, and we
might block you, especially if you open more than one or appear to be deliberately ignoring this. We especially do not
want new contributors to jump in on random issues to contribute an agent-written fix. This creates lots of noise
for reviewers and other users and will almost certainly get you blocked.

For more information, please read CONTRIBUTING.md.

  • (First-time contributors only): I confirm that this PR description and code is not written by an LLM or code agent

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline and the
    Pull Request checks?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes according to the guidelines?
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@khushali9 khushali9 mentioned this pull request Jul 9, 2026
@khushali9

Copy link
Copy Markdown
Contributor Author

@vasqu @Rocketknight1 @ydshieh Can you please review, CI is failing because of security gate, but I have added version aware fix such that anyone using pytorch <2.13 would have no issue. Also moved those setter lines to appropriate method where it belongs (enable_tf32) and keeping is_torch_available() method clean.

@khushali9 khushali9 changed the title removing redundant fix after pytorch 2.13 is released pytorch 2.13 is released , updating transformer to handle the fix tf32 issue Jul 9, 2026

@vasqu vasqu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo looks good to me but I think we are a few versions behind now on CI (2.11?) so I'd rather wait a bit and just nudge @ydshieh to have an eye out when we make the switch

@khushali9

Copy link
Copy Markdown
Contributor Author

Imo looks good to me but I think we are a few versions behind now on CI (2.11?) so I'd rather wait a bit and just nudge @ydshieh to have an eye out when we make the switch

@vasqu should not my check for torch version check take care of it ?

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution 🤗!

CI Security Gate — automatic approval blocked

This PR was not automatically approved for CI because the security gate failed.

Possible reasons:

  • The PR touches 50 or more files — only PRs with fewer than 50 changed files are automatically approved
  • A changed file is outside the allowed directories (src/, tests/, docs/, utils/), has a disallowed extension (only .py, .txt, .md permitted outside tests/ and docs/), or is not .md/.yml inside docs/
  • A new high-severity security issue was detected in the changed Python files (Bandit check)

See the workflow run for the exact violations.

A maintainer can review and manually approve CI if a finding is a false positive.

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.

2 participants