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

adding help and submitting to PR #66

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lightning_pose_app/ui/train_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ def run(self, action=None, **kwargs):
class TrainUI(LightningFlow):
"""UI to interact with training and inference."""

def __init__(self, *args, allow_context=True, max_epochs_default=300, **kwargs):
def __init__(self, *args, allow_context=True, max_epochs_default=300,
rng_seed_data_pt_default=0, **kwargs):

super().__init__(*args, **kwargs)

Expand All @@ -553,7 +554,7 @@ def __init__(self, *args, allow_context=True, max_epochs_default=300, **kwargs):
)
self.allow_context = allow_context # this will be updated if/when project is loaded
self.max_epochs_default = max_epochs_default

self.rng_seed_data_pt_default = rng_seed_data_pt_default
# flag; used internally and externally
self.run_script_train = False
# track number of times user hits buttons; used internally and externally
Expand All @@ -565,6 +566,7 @@ def __init__(self, *args, allow_context=True, max_epochs_default=300, **kwargs):
self.st_datetimes = {}
self.st_train_label_opt = None # what to do with video evaluation
self.st_max_epochs = None
self.st_rng_seed_data_pt = None

# ------------------------
# Inference
Expand Down Expand Up @@ -620,6 +622,7 @@ def _train(self, config_filename=None, video_dirname=VIDEOS_DIR):
"training": {
"imgaug": "dlc",
"max_epochs": self.st_max_epochs,
"rng_seed_data_pt": self.st_rng_seed_data_pt,
}
}

Expand Down Expand Up @@ -760,6 +763,14 @@ def _render_streamlit_fn(state: AppState):
st_max_epochs = expander.text_input(
"Set the max training epochs (all models)", value=state.max_epochs_default)

st_rng_seed_data_pt = expander.text_input(
"Set the seed/s (all models)", value=state.rng_seed_data_pt_default,
help="By setting a seed or a list of seeds, you enable reproducible model training, "
"ensuring consistent results across different runs. Users can specify a single "
"integer for individual models or a list to train multiple networks (e.g. 1,5,6,7) "
"thereby enhancing flexibility and control over the training process."
)

# unsupervised losses (semi-supervised only; only expose relevant losses)
expander.write("Select losses for semi-supervised model")
pcamv = state.config_dict["data"].get("mirrored_column_matches", [])
Expand Down Expand Up @@ -840,6 +851,7 @@ def _render_streamlit_fn(state: AppState):
# save streamlit options to flow object
state.submit_count_train += 1
state.st_max_epochs = int(st_max_epochs)
state.st_rng_seed_data_pt = int(st_rng_seed_data_pt)
state.st_train_label_opt = st_train_label_opt
state.st_train_status = {
"super": "initialized" if st_train_super else "none",
Expand Down