tensorflow/models · error · ValueError
ensure_directories_exist received an empty path or the…
Error message
ensure_directories_exist received an empty path or the current working directory ('.'); this usually indicates a configuration error. What it means
Guard in ensure_directories_exist: one of the requested directory paths is empty or resolves to '.' (the current working directory). mkdir on '.' is a no-op, and an empty path usually comes from pathlib.Path('') silently normalizing to '.', which almost always means an upstream output-directory config field was left unset. Creating the cwd as an output root would scatter pipeline outputs unpredictably, so the function refuses.
Solutions
- Fill in the missing output-directory field in the pipeline YAML (output dir, visualization dir, etc.)
- Use explicit non-empty paths; avoid Path('') which normalizes to '.'
- Audit the config for omitted optional sections whose defaults expand to empty strings
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/waste_identification_ml/model_inference_with_tracking/sam3_dinov3_tracking_pipeline/image_ops.py:93 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/4733b1be85c833b0.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/waste_identification_ml/model_inference_with_tracking/sam3_dinov3_tracking_pipeline/image_ops.py:93
bgr_resized = bgr_image
rgb_resized = cv2.cvtColor(bgr_resized, cv2.COLOR_BGR2RGB)
return Image.fromarray(rgb_resized)
def ensure_directories_exist(directories: Sequence[pathlib.Path]) -> None:
"""Creates each directory in the given sequence if it does not already exist.
Args:
directories: Paths to create. Each path must be non-empty and not point to
the current working directory (`.`).
Raises:
ValueError: If any path evaluates to `.` (e.g., from `pathlib.Path("")`) or
is empty (indicates a configuration bug).
"""
for directory in directories:
if directory == pathlib.Path("."):
raise ValueError(
"ensure_directories_exist received an empty path or the current "
"working directory ('.'); this usually indicates a configuration "
"error."
)
directory.mkdir(parents=True, exist_ok=True)
def release_caches() -> None:
"""Runs Python garbage collection and empties the CUDA allocator cache.
Intended to be called between subfolders in a long pipeline run to release
RAM and VRAM held by unreferenced objects and cached allocations. This does
not free memory held by live references.
"""
gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
View on GitHub (pinned to e006f5f0d5)