Skip to content

Commit

Permalink
fix date on model info
Browse files Browse the repository at this point in the history
  • Loading branch information
blaisewf committed Apr 14, 2024
1 parent b40fa08 commit 8b17804
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions rvc/train/process/model_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@


def prettify_date(date_str):
date_time_obj = datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%S.%f")
return date_time_obj.strftime("%Y-%m-%d %H:%M:%S")
if date_str is None:
return "None"
try:
date_time_obj = datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%S.%f")
return date_time_obj.strftime("%Y-%m-%d %H:%M:%S")
except ValueError:
return "Invalid date format"



def model_information(path):
Expand All @@ -17,17 +23,23 @@ def model_information(path):
sr = model_data.get("sr", "None")
f0 = model_data.get("f0", "None")
version = model_data.get("version", "None")
creation_date = model_data.get("creation_date", "None")
model_hash = model_data.get("model_hash", "None")
creation_date = model_data.get(
"creation_date", "None"
)
model_hash = model_data.get("model_hash", None)

pitch_guidance = "True" if f0 == 1 else "False"

creation_date_str = (
prettify_date(creation_date) if creation_date else "None"
)

return (
f"Epochs: {epochs}\n"
f"Steps: {steps}\n"
f"RVC Version: {version}\n"
f"Sampling Rate: {sr}\n"
f"Pitch Guidance: {pitch_guidance}\n"
f"Creation Date: {prettify_date(creation_date)}\n"
f"Creation Date: {creation_date_str}\n"
f"Hash (ID): {model_hash}"
)

0 comments on commit 8b17804

Please sign in to comment.