Skip to content

Commit

Permalink
Update inference types (automated commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin authored and github-actions[bot] committed Feb 4, 2025
1 parent 4afa45e commit e8ed5f7
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 34 deletions.
2 changes: 0 additions & 2 deletions docs/source/en/package_reference/inference_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ This part of the lib is still under development and will be improved in future r

[[autodoc]] huggingface_hub.TextToImageParameters

[[autodoc]] huggingface_hub.TextToImageTargetSize



## text_to_speech
Expand Down
2 changes: 0 additions & 2 deletions docs/source/ko/package_reference/inference_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,6 @@ rendered properly in your Markdown viewer.

[[autodoc]] huggingface_hub.TextToImageParameters

[[autodoc]] huggingface_hub.TextToImageTargetSize



## text_to_speech[[huggingface_hub.TextToSpeechGenerationParameters]]
Expand Down
8 changes: 4 additions & 4 deletions src/huggingface_hub/inference/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,8 +2395,8 @@ def text_to_image(
prompt: str,
*,
negative_prompt: Optional[str] = None,
height: Optional[float] = None,
width: Optional[float] = None,
height: Optional[int] = None,
width: Optional[int] = None,
num_inference_steps: Optional[int] = None,
guidance_scale: Optional[float] = None,
model: Optional[str] = None,
Expand All @@ -2422,8 +2422,8 @@ def text_to_image(
The prompt to generate an image from.
negative_prompt (`str`, *optional*):
One prompt to guide what NOT to include in image generation.
height (`float`, *optional*):
The height in pixels of the image to generate.
height (`int`, *optional*):
The height in pixels of the output image
width (`float`, *optional*):
The width in pixels of the image to generate.
num_inference_steps (`int`, *optional*):
Expand Down
8 changes: 4 additions & 4 deletions src/huggingface_hub/inference/_generated/_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2451,8 +2451,8 @@ async def text_to_image(
prompt: str,
*,
negative_prompt: Optional[str] = None,
height: Optional[float] = None,
width: Optional[float] = None,
height: Optional[int] = None,
width: Optional[int] = None,
num_inference_steps: Optional[int] = None,
guidance_scale: Optional[float] = None,
model: Optional[str] = None,
Expand All @@ -2478,8 +2478,8 @@ async def text_to_image(
The prompt to generate an image from.
negative_prompt (`str`, *optional*):
One prompt to guide what NOT to include in image generation.
height (`float`, *optional*):
The height in pixels of the image to generate.
height (`int`, *optional*):
The height in pixels of the output image
width (`float`, *optional*):
The width in pixels of the image to generate.
num_inference_steps (`int`, *optional*):
Expand Down
2 changes: 1 addition & 1 deletion src/huggingface_hub/inference/_generated/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
TextToAudioOutput,
TextToAudioParameters,
)
from .text_to_image import TextToImageInput, TextToImageOutput, TextToImageParameters, TextToImageTargetSize
from .text_to_image import TextToImageInput, TextToImageOutput, TextToImageParameters
from .text_to_speech import (
TextToSpeechEarlyStoppingEnum,
TextToSpeechGenerationParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ class AutomaticSpeechRecognitionGenerationParameters(BaseInferenceType):
class AutomaticSpeechRecognitionParameters(BaseInferenceType):
"""Additional inference parameters for Automatic Speech Recognition"""

generation_parameters: Optional[AutomaticSpeechRecognitionGenerationParameters] = None
"""Parametrization of the text generation process"""
return_timestamps: Optional[bool] = None
"""Whether to output corresponding timestamps with the generated text"""
# Will be deprecated in the future when the renaming to `generation_parameters` is implemented in transformers
generate_kwargs: Optional[AutomaticSpeechRecognitionGenerationParameters] = None
"""Parametrization of the text generation process"""


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
from dataclasses import dataclass
from typing import Literal, Optional
from typing import List, Literal, Optional, Union

from .base import BaseInferenceType

Expand All @@ -20,8 +20,8 @@ class FeatureExtractionInput(BaseInferenceType):
https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tei-import.ts.
"""

inputs: str
"""The text to embed."""
inputs: Union[List[str], str]
"""The text or list of texts to embed."""
normalize: Optional[bool] = None
prompt_name: Optional[str] = None
"""The name of the prompt that should be used by for encoding. If not set, no prompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ class ImageToTextGenerationParameters(BaseInferenceType):
class ImageToTextParameters(BaseInferenceType):
"""Additional inference parameters for Image To Text"""

generation_parameters: Optional[ImageToTextGenerationParameters] = None
"""Parametrization of the text generation process"""
max_new_tokens: Optional[int] = None
"""The amount of maximum tokens to generate."""
# Will be deprecated in the future when the renaming to `generation_parameters` is implemented in transformers
generate_kwargs: Optional[ImageToTextGenerationParameters] = None
"""Parametrization of the text generation process"""


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class TextToAudioGenerationParameters(BaseInferenceType):
class TextToAudioParameters(BaseInferenceType):
"""Additional inference parameters for Text To Audio"""

# Will be deprecated in the future when the renaming to `generation_parameters` is implemented in transformers
generate_kwargs: Optional[TextToAudioGenerationParameters] = None
generation_parameters: Optional[TextToAudioGenerationParameters] = None
"""Parametrization of the text generation process"""


Expand Down
12 changes: 4 additions & 8 deletions src/huggingface_hub/inference/_generated/types/text_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
from .base import BaseInferenceType


@dataclass
class TextToImageTargetSize(BaseInferenceType):
"""The size in pixel of the output image"""

height: int
width: int


@dataclass
class TextToImageParameters(BaseInferenceType):
"""Additional inference parameters for Text To Image"""
Expand All @@ -25,6 +17,8 @@ class TextToImageParameters(BaseInferenceType):
"""A higher guidance scale value encourages the model to generate images closely linked to
the text prompt, but values too high may cause saturation and other artifacts.
"""
height: Optional[int] = None
"""The height in pixels of the output image"""
negative_prompt: Optional[str] = None
"""One prompt to guide what NOT to include in image generation."""
num_inference_steps: Optional[int] = None
Expand All @@ -35,6 +29,8 @@ class TextToImageParameters(BaseInferenceType):
"""Override the scheduler with a compatible one."""
seed: Optional[int] = None
"""Seed for the random number generator."""
width: Optional[int] = None
"""The width in pixels of the output image"""


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class TextToSpeechGenerationParameters(BaseInferenceType):
class TextToSpeechParameters(BaseInferenceType):
"""Additional inference parameters for Text To Speech"""

# Will be deprecated in the future when the renaming to `generation_parameters` is implemented in transformers
generate_kwargs: Optional[TextToSpeechGenerationParameters] = None
generation_parameters: Optional[TextToSpeechGenerationParameters] = None
"""Parametrization of the text generation process"""


Expand Down

0 comments on commit e8ed5f7

Please sign in to comment.