Skip to content

fix(models) : string mutation bug in from_proteinnet_string#43380

Merged
Rocketknight1 merged 1 commit intohuggingface:mainfrom
aarushisingh04:fix/protein-string-mutation-bug
Jan 21, 2026
Merged

fix(models) : string mutation bug in from_proteinnet_string#43380
Rocketknight1 merged 1 commit intohuggingface:mainfrom
aarushisingh04:fix/protein-string-mutation-bug

Conversation

@aarushisingh04
Copy link
Copy Markdown
Contributor

what does this PR do?

fixes a TypeError in openfold_utils/protein.py where from_proteinnet_string attempts to mutate an immutable string in-place.

the original code tried to assign seq[i] = "X" to handle unknown residues, which crashes. this pr replaces that logic with a list comprehension to safely sanitize the sequence, resolving the existing FIXME.

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, Pull Request section?
  • 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? Here are the documentation guidelines, and here are tips on formatting docstrings.
  • Did you write any new necessary tests?

who can review?

@ArthurZucker

Copy link
Copy Markdown
Member

@Rocketknight1 Rocketknight1 left a comment

Choose a reason for hiding this comment

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

Yup, makes sense! I doubt this code path was ever taken, but the fix is clean and obviously correct so we might as well include it.

@Rocketknight1 Rocketknight1 enabled auto-merge (squash) January 21, 2026 12:50
@Rocketknight1 Rocketknight1 merged commit cc3c3c6 into huggingface:main Jan 21, 2026
19 checks passed
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

vaibhav-research pushed a commit to vaibhav-research/transformers that referenced this pull request Jan 21, 2026
…ace#43380)

fix(models): string mutation bug in from_proteinnet_string
SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Jan 23, 2026
…ace#43380)

fix(models): string mutation bug in from_proteinnet_string
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.

3 participants