From e66ee9e0d04e3138bb755c3783a32453bed2099f Mon Sep 17 00:00:00 2001 From: hlohaus <983577+hlohaus@users.noreply.github.com> Date: Mon, 10 Feb 2025 21:21:19 +0100 Subject: Fix check pipline tag in HuggingFace --- g4f/Provider/hf/HuggingFaceAPI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/g4f/Provider/hf/HuggingFaceAPI.py b/g4f/Provider/hf/HuggingFaceAPI.py index cc0f794d..976deaf0 100644 --- a/g4f/Provider/hf/HuggingFaceAPI.py +++ b/g4f/Provider/hf/HuggingFaceAPI.py @@ -64,9 +64,9 @@ class HuggingFaceAPI(OpenaiTemplate): model = cls.model_aliases[model] api_base = f"https://api-inference.huggingface.co/models/{model}/v1" pipeline_tag = await cls.get_pipline_tag(model, api_key) - if images is None and pipeline_tag not in ("text-generation", "image-text-to-text"): + if pipeline_tag not in ("text-generation", "image-text-to-text"): raise ModelNotSupportedError(f"Model is not supported: {model} in: {cls.__name__} pipeline_tag: {pipeline_tag}") - elif pipeline_tag != "image-text-to-text": + elif images and pipeline_tag != "image-text-to-text": raise ModelNotSupportedError(f"Model does not support images: {model} in: {cls.__name__} pipeline_tag: {pipeline_tag}") start = calculate_lenght(messages) if start > max_inputs_lenght: -- cgit v1.2.3