From bc47cf81526c3fafbaa7bc1f736378c58f50636e Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 28 Aug 2026 14:53:41 +1000 Subject: [PATCH] fix: preflight Hugging Face GGUF disk space --- dashboard/plugin_api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dashboard/plugin_api.py b/dashboard/plugin_api.py index 8b2bea2..1cc2650 100644 --- a/dashboard/plugin_api.py +++ b/dashboard/plugin_api.py @@ -1539,6 +1539,18 @@ def _run_huggingface_download(job_id: str, repo_id: str, filename: str) -> None: download_files = list(file_info.get("filenames") or [filename]) completed = 0 total = expected + if not total: + for remote_filename in download_files: + head_url = f"https://huggingface.co/{repo_id}/resolve/main/{remote_filename}?download=true" + try: + head_request = Request(head_url, method="HEAD", headers={"User-Agent": "Hermes-Ollama-Models/1.7.4"}) + with urlopen(head_request, timeout=30) as head_response: + total += int(head_response.headers.get("Content-Length") or 0) + except (HTTPError, URLError, OSError, ValueError): + continue + free_bytes = shutil.disk_usage(_home()).free + if total and free_bytes < total + 1024 ** 3: + raise RuntimeError("Insufficient free disk space for the complete Hugging Face GGUF download") for remote_filename in download_files: destination = destination_root / remote_filename destination.parent.mkdir(parents=True, exist_ok=True)