Skip to content

Commit cfba326

Browse files
committed
Update utils.py
1 parent 638b014 commit cfba326

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

dlclive/modelzoo/utils.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_super_animal_project_config_path(super_animal: str) -> Path:
3131
cfg_path = _MODELZOO_PATH / "project_configs" / f"{super_animal}.yaml"
3232
if not cfg_path.exists():
3333
raise FileNotFoundError(
34-
f"Modelzoo project configuration file not found: {cfg_path}Available projects: {list_available_projects()}"
34+
f"Modelzoo project configuration file not found: {cfg_path} Available projects: {list_available_projects()}"
3535
)
3636
return cfg_path
3737

@@ -89,7 +89,8 @@ def add_metadata(
8989
config["metadata"] = {
9090
"project_path": project_config["project_path"],
9191
"pose_config_path": "",
92-
"bodyparts": project_config.get("multianimalbodyparts") or project_config["bodyparts"],
92+
"bodyparts": project_config.get("multianimalbodyparts")
93+
or project_config["bodyparts"],
9394
"unique_bodyparts": project_config.get("uniquebodyparts", []),
9495
"individuals": project_config.get("individuals", ["animal"]),
9596
"with_identity": project_config.get("identity", False),
@@ -131,7 +132,9 @@ def load_super_animal_config(
131132
else:
132133
model_config["method"] = "TD"
133134
if super_animal != "superanimal_humanbody":
134-
detector_cfg_path = get_super_animal_model_config_path(model_name=detector_name)
135+
detector_cfg_path = get_super_animal_model_config_path(
136+
model_name=detector_name
137+
)
135138
detector_cfg = read_config_as_dict(detector_cfg_path)
136139
model_config["detector"] = detector_cfg
137140
return model_config
@@ -160,13 +163,17 @@ def download_super_animal_snapshot(dataset: str, model_name: str) -> Path:
160163
return model_path
161164

162165
try:
163-
download_huggingface_model(model_name, target_dir=str(snapshot_dir), rename_mapping=model_filename)
166+
download_huggingface_model(
167+
model_name, target_dir=str(snapshot_dir), rename_mapping=model_filename
168+
)
164169

165170
if not model_path.exists():
166171
raise RuntimeError(f"Failed to download {model_name} to {model_path}")
167172

168173
except Exception as e:
169-
logging.error(f"Failed to download superanimal snapshot {model_name} to {model_path}: {e}")
174+
logging.error(
175+
f"Failed to download superanimal snapshot {model_name} to {model_path}: {e}"
176+
)
170177
raise e
171178

172179
return model_path

0 commit comments

Comments
 (0)