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

New ScheduleFree support for Flux #1600

Merged
merged 14 commits into from
Sep 16, 2024
Merged

Conversation

sdbds
Copy link
Contributor

@sdbds sdbds commented Sep 15, 2024

Old version Details

Whats news?
Because testing found that Flux training works well using AdamWScheduleFree.
image

1、Add version in requirements.txt and add old schedulefree optimizer like
AdamWschedulefree and SGDScheduleFree
Directly using like --optimizer_type=AdamWschedulefree

2、(Experiment function)Add ScheduleFreeWarpper for using any base torch.opti.optimizer like Adam、RAdam、SparseAdam etc...

use --optimizer_schedulefree_wrapper to open options
use --schedulefree_wrapper_args add extra schedule free args.

SupportList:

from .adadelta import Adadelta
from .adagrad import Adagrad
from .adam import Adam
from .adamax import Adamax
from .adamw import AdamW
from .asgd import ASGD
from .lbfgs import LBFGS
from .nadam import NAdam
from .optimizer import Optimizer
from .radam import RAdam
from .rmsprop import RMSprop
from .rprop import Rprop
from .sgd import SGD
from .sparse_adam import SparseAdam

example:
--optimizer_type= "RAdam"
--optimizer_schedulefree_wrapper
--schedulefree_wrapper_args momentum=0.9, weight_decay_at_y=0.1

@kohya-ss
Copy link
Owner

Thank you. I'm sorry I couldn't merge the last PR. I'll work on this sooner this time.

@kohya-ss kohya-ss changed the base branch from sd3 to sd3-sf-opt September 16, 2024 02:02
@kohya-ss kohya-ss merged commit e634975 into kohya-ss:sd3-sf-opt Sep 16, 2024
1 check passed
@kohya-ss
Copy link
Owner

After merging, I noticed that the wrapper doesn't seem to work. I get an error TypeError: ScheduleFreeWrapper is not an Optimizer.

I'll try to fix it, but if you know anything about it, please let me know.

kohya-ss added a commit that referenced this pull request Sep 16, 2024
@kohya-ss kohya-ss mentioned this pull request Sep 16, 2024
kohya-ss added a commit that referenced this pull request Sep 17, 2024
* New ScheduleFree support for Flux (#1600)

* init

* use no schedule

* fix typo

* update for eval()

* fix typo

* update

* Update train_util.py

* Update requirements.txt

* update sfwrapper WIP

* no need to check schedulefree optimizer

* remove debug print

* comment out schedulefree wrapper

* update readme

---------

Co-authored-by: 青龍聖者@bdsqlsz <[email protected]>
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