feat: allow model metadata cli override
This commit is contained in:
parent
ba8184b034
commit
be78fb15bd
5 changed files with 58 additions and 7 deletions
|
|
@ -26,3 +26,7 @@ class SimulationSettings:
|
|||
video_output_path: Optional[str] = None
|
||||
# Camera ID to use for video recording (1 is usually the close-up camera)
|
||||
camera_id: int = 1
|
||||
|
||||
# Optional override for the sidecar metadata YAML file.
|
||||
# If None, it defaults to the model_path with a `_metadata.yaml` suffix.
|
||||
metadata_path: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -56,13 +56,15 @@ def load_params(path: Path) -> dict:
|
|||
}
|
||||
|
||||
|
||||
def load_metadata(model_path: Path) -> dict:
|
||||
def load_metadata(model_path: Path, metadata_override_path: Path | None = None) -> dict:
|
||||
"""Discover and load the sidecar metadata YAML file."""
|
||||
metadata_path = model_path.with_name(model_path.stem + "_metadata.yaml")
|
||||
if metadata_override_path is not None:
|
||||
metadata_path = metadata_override_path
|
||||
else:
|
||||
metadata_path = model_path.with_name(model_path.stem + "_metadata.yaml")
|
||||
|
||||
if not metadata_path.exists():
|
||||
raise FileNotFoundError(
|
||||
f"Could not find metadata YAML for {model_path.name}. Expected it at {metadata_path}"
|
||||
)
|
||||
raise FileNotFoundError(f"Could not find metadata YAML at {metadata_path}")
|
||||
with open(metadata_path, "r") as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
|
|
|||
Reference in a new issue