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

Update constraints to torch 2.4 dynamic_shapes API #806

Merged
merged 5 commits into from
Aug 7, 2024

Conversation

saienduri
Copy link
Contributor

@saienduri saienduri commented Aug 7, 2024

This commit updates to use dynamic_shapes for dynamic dimensions as the usage of constraints is deprecated in torch 2.4. (The SHARK test checks out the main branch of this repo and will pass once this is merged)

Copy link
Member

@dan-garvey dan-garvey left a comment

Choose a reason for hiding this comment

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

The builder failures seem unrelated, some minor nits but otherwise looks good

}
for dim_number in range(1, len(state_arg)):
current_dim_dict = {f"arg{dim_number + 1}_1": {1: state_arg0_dim1}}
dynamic_shapes_forw = {**dynamic_shapes_forw, **current_dim_dict}
Copy link
Member

Choose a reason for hiding this comment

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

does this need to be inside the for loop?

Copy link
Contributor Author

@saienduri saienduri Aug 7, 2024

Choose a reason for hiding this comment

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

Yup, we are basically adding another entry to the dictionary for every state arg dim dynamic shape constraint. It's just unpacking both dictionaries and combining them. Because the current entry is being reassigned every iteration, we need the dict concat within the loop.

models/turbine_models/custom_models/stateless_llama.py Outdated Show resolved Hide resolved
@saienduri saienduri merged commit 5e8cbb7 into main Aug 7, 2024
1 of 3 checks passed
@saienduri saienduri deleted the deprecated-constraints branch August 7, 2024 19:00
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