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 Prodigy, SophiaG optimizers #1350

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Kimiko-AI
Copy link
Contributor

@Kimiko-AI Kimiko-AI commented Mar 1, 2024

Description

https://arxiv.org/pdf/2306.06101.pdf
https://arxiv.org/abs/2305.14342

Motivation and Context

How has this been tested?

No

Screenshots (if appropriate)

Types of changes

Social Handles (Optional)


# update functions

def update_fn(p, grad, exp_avg, lr, wd, beta1, beta2):
Copy link
Collaborator

Choose a reason for hiding this comment

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

thie update_fn function is redefined below on line 106.

hessian: List[Tensor],
state_steps: List[Tensor],
*,
bs: int,
Copy link
Collaborator

Choose a reason for hiding this comment

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

bs you've set this as an int, but below you call bs.is_cuda()

@Kimiko-AI
Copy link
Contributor Author

https://wandb.ai/nruaif/Test_optim?workspace=user-nruaif
Some tests, with prodigy we don't need to change lr, just set it to 1

@winglian
Copy link
Collaborator

winglian commented Mar 6, 2024

I took a first pass at fixing the pylint errors, but mypy has still found a few issues

src/axolotl/custom_optim/sophia.py:233: error: "float" has no attribute "neg"  [attr-defined]
src/axolotl/custom_optim/lion.py:161: error: "None" not callable  [misc]
src/axolotl/custom_optim/lion.py:165: error: Invalid type 'Any' for *expr (iterable expected)  [misc]
src/axolotl/custom_optim/lion.py:165: error: Need more than 4 values to unpack (6 expected)  [misc]
src/axolotl/custom_optim/lion.py:175: error: Cannot determine type of "state"  [has-type]
src/axolotl/custom_optim/lion.py:176: error: Cannot determine type of "state"  [has-type]
src/axolotl/custom_optim/lion.py:178: error: Cannot determine type of "state"  [has-type]
src/axolotl/custom_optim/lion.py:180: error: Cannot determine type of "grad"  [has-type]
src/axolotl/custom_optim/lion.py:180: error: Cannot determine type of "lr"  [has-type]
src/axolotl/custom_optim/lion.py:180: error: Cannot determine type of "wd"  [has-type]
src/axolotl/custom_optim/lion.py:180: error: Cannot determine type of "beta1"  [has-type]
src/axolotl/custom_optim/lion.py:180: error: Cannot determine type of "beta2"  [has-type]

@hammoudhasan
Copy link

@Kimiko-AI I really think this pull request is worth finishing! Very useful - would love to see how Prodigy would perform on LLM training after I used it before on Stable Diffusion fine-tuning and it worked pretty well!

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.

None yet

3 participants