Skip to content

Commit

Permalink
Merge pull request #2707 from hlohaus/8Feb
Browse files Browse the repository at this point in the history
Fix check pipline tag in HuggingFace
  • Loading branch information
hlohaus authored Feb 10, 2025
2 parents 722b1c1 + e66ee9e commit ed02be3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions g4f/Provider/hf/HuggingFaceAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ async def create_async_generator(
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:
Expand Down

0 comments on commit ed02be3

Please sign in to comment.