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

Skip samples on training start #640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sangoi-exe
Copy link
Contributor

Just a QoL option that makes OT skip sample generation when training starts.

I’ve been annoyed by this for a long time, always having to enable and disable samples at the start of each training session. 😉

@dxqbYD
Copy link
Collaborator

dxqbYD commented Jan 18, 2025

do we want a switch to just skip the first sample...
image

...or an interval, same as for checkpoint saves:
image

[just a question - a switch is already useful on its own already]

@@ -495,6 +495,8 @@ def save(self, train_progress: TrainProgress, print_msg: bool = True, print_cb:
torch_gc()

def __needs_sample(self, train_progress: TrainProgress):
if self.config.skip_sample_on_train_start and train_progress.epoch == 0 and train_progress.epoch_step == 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the same can be accomplished easier by passing start_at_zero==False to repeating_action_needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check this out then

@sangoi-exe
Copy link
Contributor Author

do we want a switch to just skip the first sample... image

...or an interval, same as for checkpoint saves: image

[just a question - a switch is already useful on its own already]

hmm, probably the skip first would be a lot more useful, tbh 🤔

@Nerogar
Copy link
Owner

Nerogar commented Jan 18, 2025

Yes. I also think it would be more useful.

@Arcitec
Copy link
Contributor

Arcitec commented Jan 24, 2025

I really like this idea! And agree that "Skip first" with a custom field is more useful.

Edit: You can see here how the save_skip_first was implemented. So basically it would need almost the same code as this older PR:

https://github.com/Nerogar/OneTrainer/pull/482/files

@Nerogar
Copy link
Owner

Nerogar commented Feb 8, 2025

@sangoi-exe Do you still plan to implement the more useful "skip first" option, instead?

@O-J1 O-J1 added the followup Failure to provide config or other info or needs followup label Feb 9, 2025
@sangoi-exe
Copy link
Contributor Author

sangoi-exe commented Feb 9, 2025

@sangoi-exe Do you still plan to implement the more useful "skip first" option, instead?

fuck, totally forgot, it's been crazy times at work, sorry 😫
but yes, still plan to do it, already know how to do, just need to sit down and write the code

@sangoi-exe
Copy link
Contributor Author

@Nerogar sorry for the excessive delay 😬 but I think it's done now 😁

return self.single_action_elapsed(
"sample_skip_first", self.config.sample_skip_first, self.config.sample_after_unit, train_progress
) and self.repeating_action_needed(
"sample", self.config.sample_after, self.config.sample_after_unit, train_progress, start_at_zero=False
Copy link
Owner

Choose a reason for hiding this comment

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

setting start_at_zero=False means that it will never sample before training starts. If you remove that again, it can be configured by setting sample_skip_first=1 instead.

@@ -400,6 +400,7 @@ class TrainConfig(BaseConfig):
sample_audio_format: AudioFormat
samples_to_tensorboard: bool
non_ema_sampling: bool
sample_skip_first: int
Copy link
Owner

Choose a reason for hiding this comment

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

Can you move this line up just below the other two sampler_after lines? Same for the initialization of the default values further down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
followup Failure to provide config or other info or needs followup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants