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

Update release #2314

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v24.0.1
v24.0.2
4 changes: 2 additions & 2 deletions test/config/dreambooth-AdamW.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"caption_dropout_every_n_epochs": 0,
"caption_dropout_rate": 0.05,
"caption_extension": "",
"clip_skip": 2,
"clip_skip": "2",
"color_aug": false,
"dataset_config": "",
"debiased_estimation_loss": false,
Expand All @@ -19,7 +19,7 @@
"full_bf16": false,
"full_fp16": false,
"gpu_ids": "",
"gradient_accumulation_steps": 1,
"gradient_accumulation_steps": "1",
"gradient_checkpointing": false,
"huber_c": 0.1,
"huber_schedule": "snr",
Expand Down
47 changes: 36 additions & 11 deletions tools/prepare_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,53 @@
import argparse
import glob


def remove_items_with_keywords(json_file_path):
keywords = ["pretrained_model_name_or_path", "train_dir", "output_dir", "logging_dir", "image_folder", "dir", "caption_metadata_filename", "latent_metadata_filename", "save_model_as", "save_state", "resume", "output_name", "model_list", "sample_", "wandb_api_key"]

keywords = [
"caption_metadata_filename",
"dir",
"image_folder",
"latent_metadata_filename",
"logging_dir",
"model_list",
"output_dir",
"output_name",
"pretrained_model_name_or_path",
"resume",
"save_model_as",
"save_state",
"sample_",
"train_dir",
"wandb_api_key",
]

with open(json_file_path) as file:
data = json.load(file)

for key in list(data.keys()):
for keyword in keywords:
if keyword in key:
del data[key]
break

sorted_data = {k: data[k] for k in sorted(data)}
with open(json_file_path, 'w') as file:

with open(json_file_path, "w") as file:
json.dump(sorted_data, file, indent=4)

print("Items with keywords have been removed from the JSON file and the list has been sorted alphabetically:", json_file_path)

if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Remove items from JSON files based on keywords in the keys')
parser.add_argument('json_files', type=str, nargs='+', help='Path(s) to the JSON file(s)')
print(
"Items with keywords have been removed from the JSON file and the list has been sorted alphabetically:",
json_file_path,
)


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Remove items from JSON files based on keywords in the keys"
)
parser.add_argument(
"json_files", type=str, nargs="+", help="Path(s) to the JSON file(s)"
)
args = parser.parse_args()

json_files = args.json_files
Expand Down
Loading