Update common_utils.py to allow %H

this fix allows filenames to include %H, the hour of creation of the object.
This commit is contained in:
jascha ehrenreich
2024-06-01 13:57:10 +02:00
committed by GitHub
parent aa03afcfdc
commit 65acb536e5
+2 -2
View File
@@ -104,7 +104,7 @@ def parse_save_filename(save_path, output_directory, supported_extensions, class
# replace time date format to current time
now = datetime.now() # current date and time
all_date_format = ["%Y", "%m", "%d", "%M", "%S", "%f"]
all_date_format = ["%Y", "%m", "%d", "%H", "%M", "%S", "%f"]
for date_format in all_date_format:
if date_format in filename:
filename = filename.replace(date_format, now.strftime(date_format))
@@ -134,4 +134,4 @@ def resume_or_download_model_from_hf(checkpoints_dir_abs, default_repo_id, model
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id=default_repo_id, local_dir=checkpoints_dir_abs, filename=model_name, repo_type="model")
return ckpt_path
return ckpt_path