From 533c9947229be9f1941841fe0ffadf2484fdfc13 Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Mon, 25 May 2026 14:28:30 -0400 Subject: [PATCH] Silence Hugging Face Hub anonymous-request warnings Closes #918. PE-US downloads its calibrated microdata from the Hugging Face Hub on first use. Anonymous requests succeed under the lower rate limit but trigger a server-side X-HF-Warning header that huggingface_hub logs at WARNING level. TAXSIM users rarely have HF accounts and the message reads like an error; raise the huggingface_hub logger to ERROR so transient/informational notices stay hidden while real HTTP failures (which raise exceptions) still surface. Co-Authored-By: Claude Opus 4.7 (1M context) --- changelog.d/silence-hf-warning.changed.md | 1 + policyengine_taxsim/cli.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 changelog.d/silence-hf-warning.changed.md diff --git a/changelog.d/silence-hf-warning.changed.md b/changelog.d/silence-hf-warning.changed.md new file mode 100644 index 0000000..13add5b --- /dev/null +++ b/changelog.d/silence-hf-warning.changed.md @@ -0,0 +1 @@ +Suppress benign Hugging Face Hub anonymous-request warnings during CLI runs. diff --git a/policyengine_taxsim/cli.py b/policyengine_taxsim/cli.py index 97597dd..b694ef9 100644 --- a/policyengine_taxsim/cli.py +++ b/policyengine_taxsim/cli.py @@ -1,8 +1,15 @@ +import logging + import click import pandas as pd from pathlib import Path from io import StringIO +# Suppress benign Hugging Face Hub warnings (e.g., "unauthenticated requests" +# rate-limit notices) — downloads still succeed under the anonymous limit, +# and the message confuses TAXSIM users who don't have an HF account. +logging.getLogger("huggingface_hub").setLevel(logging.ERROR) + try: from .runners.policyengine_runner import PolicyEngineRunner from .runners.taxsim_runner import TaxsimRunner