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 ignore_index parameter for flash attention #580

Merged
merged 3 commits into from
May 16, 2024

Conversation

2015aroras
Copy link
Collaborator

The flash attention library changed the cross_entropy_loss parameter ignored_index to ignore_index in v2.5.8. This changes lets us support v2.5.8.

@2015aroras 2015aroras requested a review from epwalsh May 16, 2024 20:52
Copy link
Member

@epwalsh epwalsh left a comment

Choose a reason for hiding this comment

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

That's annoying! Just one suggestion

olmo/train.py Outdated
Comment on lines 157 to 163
ignore_index_kwarg = {}
if version.parse(flash_attn.__version__) >= version.parse("2.5.8"):
# The parameter name was changed in v2.5.8 with commit https://github.com/Dao-AILab/flash-attention/commit/ec6d22143b5d375e253b2ebfc563b26a43f43684
ignore_index_kwarg = {"ignore_index": ignore_index}
else:
ignore_index_kwarg = {"ignored_index": ignore_index}

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be more efficient to parse the version outside of this function, above, so we don't do it on every call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@2015aroras 2015aroras merged commit 7a462c5 into main May 16, 2024
11 checks passed
@2015aroras 2015aroras deleted the shanea/update-ignore-index-kwarg branch May 16, 2024 21:44
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