Skip to content

Commit

Permalink
Merge pull request #96 from invoke-ai/UI-Updates-2
Browse files Browse the repository at this point in the history
Clean up UI
  • Loading branch information
RyanJDick authored Mar 7, 2024
2 parents 0e936b2 + d8044ed commit ed917f6
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 277 deletions.
53 changes: 28 additions & 25 deletions src/invoke_training/ui/config_groups/base_pipeline_config_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,34 @@ def __init__(self):
interactive=True,
)
with gr.Row():
self.max_train_steps_or_epochs_dropdown = gr.Dropdown(
label="Training Length",
info="Train for a fixed number of gradient update steps or epochs.",
choices=["max_train_steps", "max_train_epochs"],
interactive=True,
)
self.max_train_steps_or_epochs = gr.Number(label="Steps or Epochs", precision=0, interactive=True)

with gr.Row():
self.save_every_n_steps_or_epochs_dropdown = gr.Dropdown(
label="Checkpoint Save Frequency",
info="Save a checkpoint every N gradient update steps or epochs.",
choices=["save_every_n_steps", "save_every_n_epochs"],
interactive=True,
)
self.save_every_n_steps_or_epochs = gr.Number(label="Steps or Epochs", precision=0, interactive=True)

with gr.Row():
self.validate_every_n_steps_or_epochs_dropdown = gr.Dropdown(
label="Validation Frequency",
info="Save validation images every N gradient update steps or epochs.",
choices=["validate_every_n_steps", "validate_every_n_epochs"],
interactive=True,
)
self.validate_every_n_steps_or_epochs = gr.Number(label="Steps or Epochs", precision=0, interactive=True)
with gr.Column():
self.max_train_steps_or_epochs_dropdown = gr.Dropdown(
label="Training Length",
info="Train for a fixed number of gradient update steps or epochs.",
choices=["max_train_steps", "max_train_epochs"],
interactive=True,
)
self.max_train_steps_or_epochs = gr.Number(label="Steps or Epochs", precision=0, interactive=True)

with gr.Column():
self.save_every_n_steps_or_epochs_dropdown = gr.Dropdown(
label="Checkpoint Save Frequency",
info="Save a checkpoint every N gradient update steps or epochs.",
choices=["save_every_n_steps", "save_every_n_epochs"],
interactive=True,
)
self.save_every_n_steps_or_epochs = gr.Number(label="Steps or Epochs", precision=0, interactive=True)

with gr.Column():
self.validate_every_n_steps_or_epochs_dropdown = gr.Dropdown(
label="Validation Frequency",
info="Save validation images every N gradient update steps or epochs.",
choices=["validate_every_n_steps", "validate_every_n_epochs"],
interactive=True,
)
self.validate_every_n_steps_or_epochs = gr.Number(
label="Steps or Epochs", precision=0, interactive=True
)
self.seed = gr.Number(
label="Seed",
info="Set to any constant integer for consistent training results. If set to null, training"
Expand Down
3 changes: 3 additions & 0 deletions src/invoke_training/ui/config_groups/dataset_config_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(self):
info="The Hugging Face dataset config name. Leave as None if there's only one config.",
interactive=True,
)
with gr.Row():
self.hf_cache_dir = gr.Textbox(
label="Cache Directory",
info="The Hugging Face cache directory to use for dataset downloads. If None, the default value"
Expand Down Expand Up @@ -113,6 +114,7 @@ def __init__(self):
self.dataset_dir = gr.Textbox(
label="dataset_dir", info="The path to the dataset directory.", interactive=True
)
with gr.Row():
self.keep_in_memory = gr.Checkbox(
label="keep_in_memory",
info="If True, the entire dataset will be kept in RAM. This increases speed for small datasets at the "
Expand Down Expand Up @@ -146,6 +148,7 @@ def __init__(self):
self.dataset_dir = gr.Textbox(
label="dataset_dir", info="The path to the dataset directory.", interactive=True
)
with gr.Row():
self.keep_in_memory = gr.Checkbox(
label="keep_in_memory",
info="If True, the entire dataset will be kept in RAM. This increases speed for small datasets at the "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,54 @@
class ImageCaptionSDDataLoaderConfigGroup(UIConfigElement):
def __init__(self):
with gr.Tab("Data Source Configs"):
with gr.Group():
self.dataset = DatasetConfigGroup(
allowed_types=[
"HF_HUB_IMAGE_CAPTION_DATASET",
"IMAGE_CAPTION_JSONL_DATASET",
"IMAGE_CAPTION_DIR_DATASET",
]
)

with gr.Tab("Data Loading Configs"):
with gr.Group():
with gr.Row():
self.resolution = gr.Number(
label="Resolution",
info="The resolution for input images. All of the images in the dataset will be"
" resized to this resolution unless the aspect_ratio_buckets config is set.",
precision=0,
interactive=True,
)
self.dataloader_num_workers = gr.Number(
label="Dataloading Workers",
info="Number of subprocesses to use for data loading. 0 means that the data will"
" be loaded in the main process.",
precision=0,
interactive=True,
)
with gr.Row():
self.center_crop = gr.Checkbox(
label="Center Crop",
info="If set, input images will be center-cropped to the target resolution. Otherwise,"
" input images will be randomly cropped to the target resolution.",
interactive=True,
)
self.random_flip = gr.Checkbox(
label="Random Flip",
info="If set, random flip augmentations will be applied to input images.",
interactive=True,
)
self.caption_prefix = gr.Textbox(
label="Caption Prefix",
info="A prefix that will be prepended to all captions. If None, no prefix will be added.",
interactive=True,
)
with gr.Tab("Aspect Ratio Bucketing Configs"):
self.aspect_ratio_bucket_config_group = AspectRatioBucketConfigGroup()
with gr.Row():
with gr.Column(scale=1):
with gr.Group():
self.dataset = DatasetConfigGroup(
allowed_types=[
"HF_HUB_IMAGE_CAPTION_DATASET",
"IMAGE_CAPTION_JSONL_DATASET",
"IMAGE_CAPTION_DIR_DATASET",
]
)
with gr.Column(scale=3):
with gr.Tab("Data Loading Configs"):
with gr.Group():
with gr.Row():
self.resolution = gr.Number(
label="Resolution",
info="The resolution for input images. All of the images in the dataset will be"
" resized to this resolution unless the aspect_ratio_buckets config is set.",
precision=0,
interactive=True,
)
self.dataloader_num_workers = gr.Number(
label="Dataloading Workers",
info="Number of subprocesses to use for data loading. 0 means that the data will"
" be loaded in the main process.",
precision=0,
interactive=True,
)
with gr.Row():
self.center_crop = gr.Checkbox(
label="Center Crop",
info="If set, input images will be center-cropped to the target resolution."
" Otherwise, input images will be randomly cropped to the target resolution.",
interactive=True,
)
self.random_flip = gr.Checkbox(
label="Random Flip",
info="If set, random flip augmentations will be applied to input images.",
interactive=True,
)
self.caption_prefix = gr.Textbox(
label="Caption Prefix",
info="A prefix that will be prepended to all captions."
" If None, no prefix will be added.",
interactive=True,
)
with gr.Tab("Aspect Ratio Bucketing Configs"):
self.aspect_ratio_bucket_config_group = AspectRatioBucketConfigGroup()

def update_ui_components_with_config_data(
self, config: ImageCaptionSDDataLoaderConfig
Expand Down
51 changes: 27 additions & 24 deletions src/invoke_training/ui/config_groups/sd_lora_config_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,33 @@ def __init__(self):
"""The SD_LORA configs."""

gr.Markdown("## Basic Configs")
with gr.Tab("Base Model"):
self.model = gr.Textbox(
label="Model",
info="The base model. Can be a Hugging Face Hub model name, or a path to a local model (in "
"diffusers or checkpoint format).",
type="text",
interactive=True,
)
self.hf_variant = gr.Textbox(
label="Variant",
info="(optional) The Hugging Face hub model variant (e.g., fp16, fp32) to use if the model is a HF "
"Hub model name.",
type="text",
interactive=True,
)
with gr.Tab("Training Outputs"):
self.base_pipeline_config_group = BasePipelineConfigGroup()
self.max_checkpoints = gr.Number(
label="Maximum Number of Checkpoints",
info="The maximum number of checkpoints to keep on disk from this training run. Earlier "
"checkpoints will be deleted to respect this limit.",
interactive=True,
precision=0,
)
with gr.Row():
with gr.Column(scale=1):
with gr.Tab("Base Model"):
self.model = gr.Textbox(
label="Model",
info="The base model. Can be a Hugging Face Hub model name, or a path to a local model (in "
"diffusers or checkpoint format).",
type="text",
interactive=True,
)
self.hf_variant = gr.Textbox(
label="Variant",
info="(optional) The Hugging Face hub model variant (e.g., fp16, fp32) to use if the model is a"
" HF Hub model name.",
type="text",
interactive=True,
)
with gr.Column(scale=3):
with gr.Tab("Training Outputs"):
self.base_pipeline_config_group = BasePipelineConfigGroup()
self.max_checkpoints = gr.Number(
label="Maximum Number of Checkpoints",
info="The maximum number of checkpoints to keep on disk from this training run. Earlier "
"checkpoints will be deleted to respect this limit.",
interactive=True,
precision=0,
)

gr.Markdown("## Data Configs")
self.image_caption_sd_data_loader_config_group = ImageCaptionSDDataLoaderConfigGroup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,33 @@ def __init__(self):
"""The SD_TEXTUAL_INVERSION configs."""

gr.Markdown("## Basic Configs")
with gr.Tab("Base Model"):
self.model = gr.Textbox(
label="Model",
info="The base model. Can be a Hugging Face Hub model name, or a path to a local model (in "
"diffusers or checkpoint format).",
type="text",
interactive=True,
)
self.hf_variant = gr.Textbox(
label="Variant",
info="(optional) The Hugging Face hub model variant (e.g., fp16, fp32) to use if the model is a HF "
"Hub model name.",
type="text",
interactive=True,
)
with gr.Tab("Training Outputs"):
self.base_pipeline_config_group = BasePipelineConfigGroup()
self.max_checkpoints = gr.Number(
label="Maximum Number of Checkpoints",
info="The maximum number of checkpoints to keep on disk from this training run. Earlier "
"checkpoints will be deleted to respect this limit.",
interactive=True,
precision=0,
)
with gr.Row():
with gr.Column(scale=1):
with gr.Tab("Base Model"):
self.model = gr.Textbox(
label="Model",
info="The base model. Can be a Hugging Face Hub model name, or a path to a local model (in "
"diffusers or checkpoint format).",
type="text",
interactive=True,
)
self.hf_variant = gr.Textbox(
label="Variant",
info="(optional) The Hugging Face hub model variant (e.g., fp16, fp32) to use if the model is a"
" HF Hub model name.",
type="text",
interactive=True,
)
with gr.Column(scale=3):
with gr.Tab("Training Outputs"):
self.base_pipeline_config_group = BasePipelineConfigGroup()
self.max_checkpoints = gr.Number(
label="Maximum Number of Checkpoints",
info="The maximum number of checkpoints to keep on disk from this training run. Earlier "
"checkpoints will be deleted to respect this limit.",
interactive=True,
precision=0,
)

gr.Markdown("## Data Configs")
self.textual_inversion_sd_data_loader_config_group = TextualInversionSDDataLoaderConfigGroup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,39 @@ def __init__(self):
"""The SDXL_LORA_AND_TEXTUAL_INVERSION configs."""

gr.Markdown("## Basic Configs")
with gr.Tab("Base Model"):
self.model = gr.Textbox(
label="Model",
info="The base model. Can be a Hugging Face Hub model name, or a path to a local model (in "
"diffusers or checkpoint format).",
type="text",
interactive=True,
)
self.hf_variant = gr.Textbox(
label="Variant",
info="(optional) The Hugging Face hub model variant (e.g., fp16, fp32) to use if the model is a HF "
"Hub model name.",
type="text",
interactive=True,
)
self.vae_model = gr.Textbox(
label="VAE Model",
info="(optional) If set, this overrides the base model's default VAE model.",
type="text",
interactive=True,
)
with gr.Tab("Training Outputs"):
self.base_pipeline_config_group = BasePipelineConfigGroup()
self.max_checkpoints = gr.Number(
label="Maximum Number of Checkpoints",
info="The maximum number of checkpoints to keep on disk from this training run. Earlier "
"checkpoints will be deleted to respect this limit.",
interactive=True,
precision=0,
)
with gr.Row():
with gr.Column(scale=1):
with gr.Tab("Base Model"):
self.model = gr.Textbox(
label="Model",
info="The base model. Can be a Hugging Face Hub model name, or a path to a local model (in "
"diffusers or checkpoint format).",
type="text",
interactive=True,
)
self.hf_variant = gr.Textbox(
label="Variant",
info="(optional) The Hugging Face hub model variant (e.g., fp16, fp32) to use if the model is a"
" HF Hub model name.",
type="text",
interactive=True,
)
self.vae_model = gr.Textbox(
label="VAE Model",
info="(optional) If set, this overrides the base model's default VAE model.",
type="text",
interactive=True,
)
with gr.Column(scale=3):
with gr.Tab("Training Outputs"):
self.base_pipeline_config_group = BasePipelineConfigGroup()
self.max_checkpoints = gr.Number(
label="Maximum Number of Checkpoints",
info="The maximum number of checkpoints to keep on disk from this training run. Earlier "
"checkpoints will be deleted to respect this limit.",
interactive=True,
precision=0,
)

gr.Markdown("## Data Configs")
self.image_caption_sd_data_loader_config_group = TextualInversionSDDataLoaderConfigGroup()
Expand Down
Loading

0 comments on commit ed917f6

Please sign in to comment.