export cli

This commit is contained in:
mertalev
2023-11-12 18:01:12 -05:00
parent 069a32dcdb
commit ae80def7f2
5 changed files with 135 additions and 71 deletions
+7
View File
@@ -3,6 +3,9 @@ from pathlib import Path
from typing import Any
_clean_name = str.maketrans(":\\/", "___", ".")
def get_model_path(output_dir: Path | str) -> Path:
output_dir = Path(output_dir)
output_dir.mkdir(parents=True, exist_ok=True)
@@ -13,3 +16,7 @@ def save_config(config: Any, output_path: Path | str) -> None:
output_path = Path(output_path)
output_path.parent.mkdir(parents=True, exist_ok=True)
json.dump(config, output_path.open("w"))
def clean_name(model_name: str) -> str:
return model_name.split("/")[-1].translate(_clean_name)