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

add support for opimum bettertransformers #92

Merged
merged 15 commits into from
Jun 14, 2023
Merged

add support for opimum bettertransformers #92

merged 15 commits into from
Jun 14, 2023

Conversation

winglian
Copy link
Collaborator

@winglian winglian commented May 27, 2023

https://pytorch.org/blog/out-of-the-box-acceleration/

testing initial support for gpt-neox arch

@NanoCode012
Copy link
Collaborator

NanoCode012 commented May 28, 2023

I checked that Pytorch link. This is not a torch 2.0 feature only right?

Edit: I also see a float16. This is different from fp16?

@winglian
Copy link
Collaborator Author

so I had to add float16 as an option b/c there is no way to have the model load as float16 currently without enabling automatic mixed precision which kicks in when you pass fp16 or bf16 to the trainer.

@winglian
Copy link
Collaborator Author

might be easiest to warn or raise a ValueError if they are using torch.__version__.split(".")[0] < 2 ?

@winglian winglian added the enhancement New feature or request label May 28, 2023
@NanoCode012
Copy link
Collaborator

might be easiest to warn or raise a ValueError if they are using torch.__version__.split(".")[0] < 2 ?

I think this is good.

so I had to add float16 as an option b/c there is no way to have the model load as float16 currently without enabling automatic mixed precision which kicks in when you pass fp16 or bf16 to the trainer.

I just worry this will be confusing.. Could we just check for cfg.flash_optimum then handle it better instead of creating a new config?

@winglian
Copy link
Collaborator Author

what about cfg.flash_optimum_float32? this way we default to float16 when cfg.flash_optimum is set (the sane default), but if they really wanted float32, they can set it here.

@NanoCode012
Copy link
Collaborator

NanoCode012 commented May 28, 2023

what about cfg.flash_optimum_float32? this way we default to float16 when cfg.flash_optimum is set (the sane default), but if they really wanted float32, they can set it here.

Hm, by default, I think people would expect their code to be float32. Would cfg.flash_optimum_float16 be better?

Edit: Could you also add it to Readme in case I forget to later?

@winglian
Copy link
Collaborator Author

winglian commented Jun 9, 2023

Hm, by default, I think people would expect their code to be float32. Would cfg.flash_optimum_float16 be better?

so in doing some additional experiments, there are cases where I need to explicitly load in float16 where I'm not using bettertransformers

Copy link
Collaborator

@NanoCode012 NanoCode012 left a comment

Choose a reason for hiding this comment

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

I think some parts have been discussed before, but not sure if we decided on something.

examples/pythia-12b/config.yml Outdated Show resolved Hide resolved
examples/pythia-12b/config.yml Outdated Show resolved Hide resolved
scripts/finetune.py Outdated Show resolved Hide resolved
scripts/finetune.py Outdated Show resolved Hide resolved
scripts/finetune.py Outdated Show resolved Hide resolved
src/axolotl/utils/data.py Outdated Show resolved Hide resolved
src/axolotl/utils/models.py Show resolved Hide resolved
src/axolotl/utils/models.py Show resolved Hide resolved
src/axolotl/utils/trainer.py Outdated Show resolved Hide resolved
src/axolotl/utils/validation.py Show resolved Hide resolved
@winglian winglian merged commit 16bb627 into main Jun 14, 2023
@winglian winglian deleted the flash-optimum branch June 15, 2023 12:31
mkeoliya pushed a commit to mkeoliya/axolotl that referenced this pull request Dec 15, 2023
…flash-optimum

add support for opimum bettertransformers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants