Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump transformers version to 4.48.1 #771

Merged
merged 11 commits into from
Jan 30, 2025
Merged

Bump transformers version to 4.48.1 #771

merged 11 commits into from
Jan 30, 2025

Conversation

dacorvo
Copy link
Collaborator

@dacorvo dacorvo commented Jan 29, 2025

What does this PR do?

This bumps the transformers version to 4.48.1 to allow the deployment of images containing optimum-neuron in AWS services (all previous transformers versions are now rejected because they include some scripts identified as potentially harmful).

This also modifies the documentation to change the installation instructions: installing as an optimum extra is no longer recommended and will be soon deprecated.

There were some changes in transformers modeling for LLama and Mistral models attention forward that needed to be reflected in the distributed parallelization modeling code.

There were also some changes in the attributes of the transformers Attention classes for the same models that broke the parallelization dynamic transformations: the changes in this pull-request are just a workaround, and eventually these dynamic transformations should be replaced by explicit modeling code (the forward methods are already overloaded, so there is no point in patching dynamically the layers where it would be simpler to recreate them directly from the config).

@HuggingFaceDocBuilderDev

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.

In order to be able to be independent of optimum releases to update
optimum-neuron transformer dependency, we now recommend a direct
installation instead of installing optimum-neuron as an optimum extra.
@dacorvo dacorvo force-pushed the bump_transformers_version branch from 668423c to 565639f Compare January 29, 2025 16:33
This is because otherwise contronel-aux will pull an extremely old
version of timm.
The parallelization code expects these parameters to be set. A proper
fix would be to write a specific Llama parallel model.
The transformation code expects some attributes to be set.
@dacorvo dacorvo force-pushed the bump_transformers_version branch from 565639f to 2fc13fc Compare January 30, 2025 09:19
@dacorvo dacorvo marked this pull request as ready for review January 30, 2025 10:47
Copy link
Collaborator

@JingyaHuang JingyaHuang left a comment

Choose a reason for hiding this comment

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

lgtm, thanks.

Copy link
Member

@michaelbenayoun michaelbenayoun left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +590 to +593
# FIXME: temporary workaround to avoid too many changes in the transformation code
layer.self_attn.num_heads = layer.self_attn.config.num_attention_heads
layer.self_attn.num_key_value_heads = layer.self_attn.config.num_key_value_heads
layer.self_attn.hidden_size = layer.self_attn.config.hidden_size
Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@dacorvo dacorvo merged commit e84e0c6 into main Jan 30, 2025
11 of 13 checks passed
@dacorvo dacorvo deleted the bump_transformers_version branch January 30, 2025 13:47
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.

5 participants