import os from huggingface_hub import hf_hub_download def resolve_file(path): if not path: return path if os.path.isfile(path): return os.path.abspath(path) parts = path.replace("\\", "/").strip("/").split("/") if len(parts) >= 3 and not os.path.isabs(path): repo_id = "/".join(parts[:2]) filename = "/".join(parts[2:]) local_path = hf_hub_download(repo_id=repo_id, filename=filename) print(f"[weights] {path} -> {local_path}") return local_path raise FileNotFoundError( f"weight file not found: {path}. Pass a local file or Hugging Face repo_id/filename." )