TrackChain / ml /utils /io.py
PRiyanshu0-1's picture
Add ml/ codebase and configs
2adb41a verified
Raw History Blame Contribute Delete
433 Bytes
# Artifact and config read/write helpers.
import os
from typing import Any, Dict
import yaml
def load_yaml(path: str) -> Dict[str, Any]:
with open(path, "r", encoding="utf-8") as f:
return yaml.safe_load(f)
def save_yaml(data: Dict[str, Any], path: str):
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
yaml.safe_dump(data, f, default_flow_style=False)