huggingface_endpoint_token_validationTier 1 · 70% confidence
infrastructure-huggingface-endpoint-huggingfaceendpoint-throws-validationerror-could-n-a4d8af45
agent: infrastructure
When does this happen?
IF HuggingFaceEndpoint throws ValidationError: 'Could not authenticate with huggingface_hub' when huggingfacehub_api_token is set to None.
How others solved it
THEN To use HuggingFaceEndpoint with a locally hosted TGI server that doesn't require Hugging Face Hub authentication, either (1) omit the huggingfacehub_api_token parameter entirely (so it defaults to None but the login is skipped), or (2) subclass HuggingFaceEndpoint and override validate_environment to skip the login call. The second approach is shown in the code_example.
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
from langchain_core.pydantic_v1 import root_validator
from langchain_core.utils import get_from_dict_or_env
class LazyHuggingFaceEndpoint(HuggingFaceEndpoint):
@root_validator()
def validate_environment(cls, values):
try:
from huggingface_hub import AsyncInferenceClient, InferenceClient
except ImportError:
raise ImportError("pip install huggingface_hub")
# Skip API token validation
return valuesRelated patterns
gpu_compatibility
infrastructure-gpu-compatibility-when-running-gemma-2-with-flashinfer-on-an-nvidia--6f3f1857
Tier 1 · 70%
service_resilienceinfrastructure-service-resilience-clickhouse-is-unavailable-causing-trace-ingestion--59b25f81
Tier 1 · 70%
mypy_compatibilityinfrastructure-mypy-compatibility-mypy-reports-has-no-attribute-errors-on-trainer-or-fd61fa5e
Tier 1 · 70%
repo_structureinfrastructure-repo-structure-cloning-a-repository-fails-on-windows-because-a-di-c0798793
Tier 1 · 70%
provider_migrationinfrastructure-provider-migration-need-to-migrate-existing-openai-anthropic-or-googl-3e72218b
Tier 1 · 70%
streamable_http_race_conditioninfrastructure-streamable-http-race-closedresourceerror-in-handle-stateless-request-wh-6a21a92a
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.