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 121459b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/huggingface_hub/inference/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
TextGenerationInputGrammarType,
TextGenerationOutput,
TextGenerationStreamOutput,
TextToImageTargetSize,
TextToSpeechEarlyStoppingEnum,
TokenClassificationAggregationStrategy,
TokenClassificationOutputElement,
Expand Down Expand Up @@ -2403,6 +2404,7 @@ def text_to_image(
scheduler: Optional[str] = None,
seed: Optional[int] = None,
extra_body: Optional[Dict[str, Any]] = None,
target_size: Optional[TextToImageTargetSize] = None,
) -> "Image":
"""
Generate an image based on a given text using a specified model.
Expand Down Expand Up @@ -2443,6 +2445,8 @@ def text_to_image(
extra_body (`Dict[str, Any]`, *optional*):
Additional provider-specific parameters to pass to the model. Refer to the provider's documentation
for supported parameters.
target_size (`TextToImageTargetSize`, *optional*):
The size in pixel of the output image
Returns:
`Image`: The generated image.
Expand Down
4 changes: 4 additions & 0 deletions src/huggingface_hub/inference/_generated/_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
TextGenerationInputGrammarType,
TextGenerationOutput,
TextGenerationStreamOutput,
TextToImageTargetSize,
TextToSpeechEarlyStoppingEnum,
TokenClassificationAggregationStrategy,
TokenClassificationOutputElement,
Expand Down Expand Up @@ -2459,6 +2460,7 @@ async def text_to_image(
scheduler: Optional[str] = None,
seed: Optional[int] = None,
extra_body: Optional[Dict[str, Any]] = None,
target_size: Optional[TextToImageTargetSize] = None,
) -> "Image":
"""
Generate an image based on a given text using a specified model.
Expand Down Expand Up @@ -2499,6 +2501,8 @@ async def text_to_image(
extra_body (`Dict[str, Any]`, *optional*):
Additional provider-specific parameters to pass to the model. Refer to the provider's documentation
for supported parameters.
target_size (`TextToImageTargetSize`, *optional*):
The size in pixel of the output image
Returns:
`Image`: The generated image.
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 All @@ -99,7 +98,7 @@ class AutomaticSpeechRecognitionInput(BaseInferenceType):
class AutomaticSpeechRecognitionOutputChunk(BaseInferenceType):
text: str
"""A chunk of text identified by the model"""
timestamp: List[float]
timestamps: List[float]
"""The start and end timestamps corresponding with the text"""


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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class TextToImageParameters(BaseInferenceType):
"""Override the scheduler with a compatible one."""
seed: Optional[int] = None
"""Seed for the random number generator."""
target_size: Optional[TextToImageTargetSize] = None
"""The size in pixel 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 121459b

Please sign in to comment.