HCPDigitalTwin / engine /loader.py
jmisak's picture
Upload folder using huggingface_hub
15b744c verified
raw
history blame contribute delete
447 Bytes
import yaml
import os
def load_persona(path):
if not os.path.exists(path):
raise FileNotFoundError(f"Persona file not found: {path}")
with open(path, "r", encoding="utf-8") as f:
persona = yaml.safe_load(f)
required_keys = ["name", "dynamic_state", "segment_drift"]
for key in required_keys:
if key not in persona:
raise ValueError(f"Missing required key: {key}")
return persona