Textual inv make save log both steps#2178
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
|
will try fixing the checks. Bit confused why it failed though. |
| ) | ||
| parser.add_argument( | ||
| "--validation_epochs", | ||
| "--validation_steps", |
There was a problem hiding this comment.
Using steps here (and in dreambooth) script makes sense to me and also it aligns well with save_steps. But Removing the existing arg would be a breaking change,
Instead of changing the arg, maybe we could introduce an additional arg called validation_steps and allow only one of them to be set. Inside the script, we always use validation_steps , we can compute that easily using the epochs value. And to align saving and validating we could prefer the validation_steps argument in the docs.
There was a problem hiding this comment.
@patil-suraj good point! One point that I have is to do this we might want to make the logging a function(because calling in 2 places)
But if we do that we need to pass wandb as an argument as we aren't doing the import in the global scope. I was thinking of doing this before but it felt a bit hacky. Happy to show what I mean!
There was a problem hiding this comment.
Preferring config via steps over epochs makes sense to me 👍
There was a problem hiding this comment.
Steps also makes sense to me but let's deprecate validation_epochs nicely. Could we keep validation_epochs and just add a new validation_steps . Then will convert validation_epochs to validation_steps if used and throw a deprecation warning. Would that be ok for you @isamu-isozaki ?
There was a problem hiding this comment.
@patrickvonplaten yup sounds good! Then will move the code to a function so it's cleaner
|
@isamu-isozaki I'm not sure I see what logic would have to be moved to a function? Regardless, I do think importing wandb on the top level of the module is better as I don't think there's intention to scope the import to the function. |
|
@williamberman Thanks for the review! Ah if we just going with steps then no worries! I was mainly talking about if we want to support logging either for steps or epochs |
|
Will fix merge conflict |
|
Hey @isamu-isozaki we just updated some style dependencies cf #2279 , so you'll need to update the diffusers with Rebase the branch and then run Let me know if you need any help with this. |
|
Sounds good! Fixing merge conflict and style now |
|
@patil-suraj @williamberman Should be fixed! One small note. When testing I noticed that the default train_batch_size is 16 which might be a bit tough for non-high-end gpus. |
|
Interesting. I'll try fixing my version of black and fix the styles |
|
I do have black version 23.1.0 which should be exactly the same. I'll see if I can figure out the issue. |
| warnings.warn( | ||
| f"Future Warning: You are doing logging with validation_epochs={args.validation_epochs}." | ||
| " validation_epochs is being deprecated in favor of validation_steps.", | ||
| FutureWarning, | ||
| stacklevel=2, |
There was a problem hiding this comment.
Could we move the warning to directly after parse_args
There was a problem hiding this comment.
|
Looks basically there :) |
| default=None, | ||
| help=( | ||
| "Run validation every X epochs. Validation consists of running the prompt" | ||
| "Deprecated in favor of validation_steps. Run validation every X epochs. Validation consists of running the prompt" |
There was a problem hiding this comment.
Can we add the deprecation statement right below the argparsing like @williamberman mentioned below and do something like:
if args.validation_epochs is not None:
warnings.warn(f"Deprecate ..... Please make sure to use `validation_steps` instead in the future. Setting `args.validation_steps` to {args.validation_epochs * num_samples_per_epoch}.")
args.validation_steps = There was a problem hiding this comment.
once this is done args.validation_epochs doesn't have to be used anymore and it'll also be much easier to remove in the future.
There was a problem hiding this comment.
@patrickvonplaten Great point! For the length of the validation steps, I put it after the dataset creation since that is where we count the number of images in the folder/find out the length of each epoch
|
@patrickvonplaten @williamberman Thanks a bunch for the reviews! Will fix now |
….com/isamu-isozaki/diffusers into textual_inv_make_save_log_both_steps
Co-authored-by: Will Berman <wlbberman@gmail.com>
|
@patrickvonplaten @williamberman Should be fixed! For the deprecation warning, I did it after the dataset creation because that's when we know the size of each epoch. For everything else should be fixed! |
|
Testing now |
|
Ok, I don't know if this is a bug with the code but for the first image, it doesn't log. But after the second one, it starts logging. Will double-check. |
|
By not logging, I mean the pipeline gets run but it doesn't go to wandb. |
|
Actually, I noticed this in general with wandb. Sorry, prob not relevant. |
|
Anyways should be done! |
| FutureWarning, | ||
| stacklevel=2, | ||
| ) | ||
| args.validation_steps = args.validation_epochs * len(train_dataset) |
patrickvonplaten
left a comment
There was a problem hiding this comment.
Looks good to me!
|
@williamberman could you check here? |
|
Thanks a lot @isamu-isozaki |
|
@patrickvonplaten np! Always happy to contribute |
* Initial commit * removed images * Made logging the same as save * Removed logging function * Quality fixes * Quality fixes * Tested * Added support back for validation_epochs * Fixing styles * Did changes * Change to log_validation * Add extra space after wandb import * Add extra space after wandb Co-authored-by: Will Berman <wlbberman@gmail.com> * Fixed spacing --------- Co-authored-by: Will Berman <wlbberman@gmail.com>
* Initial commit * removed images * Made logging the same as save * Removed logging function * Quality fixes * Quality fixes * Tested * Added support back for validation_epochs * Fixing styles * Did changes * Change to log_validation * Add extra space after wandb import * Add extra space after wandb Co-authored-by: Will Berman <wlbberman@gmail.com> * Fixed spacing --------- Co-authored-by: Will Berman <wlbberman@gmail.com>
Based on this issue. Still a WIP. I'm trying to keep the logging functionality to be the same as the same functionality where every x amounts of steps, we log.
I was thinking of moving the logic of the logging to a function. But then I need a way to get wandb there. I was thinking of passing it in as a default parameter or if available, automatically import. Let me know if anyone has some ideas for this.