From e88203e1abd98dd103a1e3dfdd884a2353c4df3b Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Mon, 23 Feb 2026 10:05:11 +0800 Subject: [PATCH] fix: skip config.json download counter when HF_HUB_OFFLINE is set The hf_hub_download call for config.json (used only to increment the download counter) fails when HF_HUB_OFFLINE=1. Guard the call with an environment variable check. Fixes #54 Signed-off-by: haosenwang1018 --- moshi/moshi/server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/moshi/moshi/server.py b/moshi/moshi/server.py index 771f491d..a2e596d5 100644 --- a/moshi/moshi/server.py +++ b/moshi/moshi/server.py @@ -426,7 +426,9 @@ def main(): # Download config.json to increment download counter # No worries about double-counting since config.json will be cached the second time - hf_hub_download(args.hf_repo, "config.json") + # Skip when running in offline mode (HF_HUB_OFFLINE=1) + if not os.environ.get("HF_HUB_OFFLINE"): + hf_hub_download(args.hf_repo, "config.json") logger.info("loading mimi") if args.mimi_weight is None: