Skip to content

Commit 4662b7b

Browse files
Wauplingithub-actions[bot]
authored andcommitted
Update inference types (automated commit)
1 parent 4afa45e commit 4662b7b

File tree

8 files changed

+20
-14
lines changed

8 files changed

+20
-14
lines changed

src/huggingface_hub/inference/_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
TextGenerationInputGrammarType,
9393
TextGenerationOutput,
9494
TextGenerationStreamOutput,
95+
TextToImageTargetSize,
9596
TextToSpeechEarlyStoppingEnum,
9697
TokenClassificationAggregationStrategy,
9798
TokenClassificationOutputElement,
@@ -2403,6 +2404,7 @@ def text_to_image(
24032404
scheduler: Optional[str] = None,
24042405
seed: Optional[int] = None,
24052406
extra_body: Optional[Dict[str, Any]] = None,
2407+
target_size: Optional[TextToImageTargetSize] = None,
24062408
) -> "Image":
24072409
"""
24082410
Generate an image based on a given text using a specified model.
@@ -2443,6 +2445,8 @@ def text_to_image(
24432445
extra_body (`Dict[str, Any]`, *optional*):
24442446
Additional provider-specific parameters to pass to the model. Refer to the provider's documentation
24452447
for supported parameters.
2448+
target_size (`TextToImageTargetSize`, *optional*):
2449+
The size in pixel of the output image
24462450
24472451
Returns:
24482452
`Image`: The generated image.

src/huggingface_hub/inference/_generated/_async_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
TextGenerationInputGrammarType,
7878
TextGenerationOutput,
7979
TextGenerationStreamOutput,
80+
TextToImageTargetSize,
8081
TextToSpeechEarlyStoppingEnum,
8182
TokenClassificationAggregationStrategy,
8283
TokenClassificationOutputElement,
@@ -2459,6 +2460,7 @@ async def text_to_image(
24592460
scheduler: Optional[str] = None,
24602461
seed: Optional[int] = None,
24612462
extra_body: Optional[Dict[str, Any]] = None,
2463+
target_size: Optional[TextToImageTargetSize] = None,
24622464
) -> "Image":
24632465
"""
24642466
Generate an image based on a given text using a specified model.
@@ -2499,6 +2501,8 @@ async def text_to_image(
24992501
extra_body (`Dict[str, Any]`, *optional*):
25002502
Additional provider-specific parameters to pass to the model. Refer to the provider's documentation
25012503
for supported parameters.
2504+
target_size (`TextToImageTargetSize`, *optional*):
2505+
The size in pixel of the output image
25022506
25032507
Returns:
25042508
`Image`: The generated image.

src/huggingface_hub/inference/_generated/types/automatic_speech_recognition.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ class AutomaticSpeechRecognitionGenerationParameters(BaseInferenceType):
7676
class AutomaticSpeechRecognitionParameters(BaseInferenceType):
7777
"""Additional inference parameters for Automatic Speech Recognition"""
7878

79+
generation_parameters: Optional[AutomaticSpeechRecognitionGenerationParameters] = None
80+
"""Parametrization of the text generation process"""
7981
return_timestamps: Optional[bool] = None
8082
"""Whether to output corresponding timestamps with the generated text"""
81-
# Will be deprecated in the future when the renaming to `generation_parameters` is implemented in transformers
82-
generate_kwargs: Optional[AutomaticSpeechRecognitionGenerationParameters] = None
83-
"""Parametrization of the text generation process"""
8483

8584

8685
@dataclass
@@ -99,7 +98,7 @@ class AutomaticSpeechRecognitionInput(BaseInferenceType):
9998
class AutomaticSpeechRecognitionOutputChunk(BaseInferenceType):
10099
text: str
101100
"""A chunk of text identified by the model"""
102-
timestamp: List[float]
101+
timestamps: List[float]
103102
"""The start and end timestamps corresponding with the text"""
104103

105104

src/huggingface_hub/inference/_generated/types/feature_extraction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
55
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
66
from dataclasses import dataclass
7-
from typing import Literal, Optional
7+
from typing import List, Literal, Optional, Union
88

99
from .base import BaseInferenceType
1010

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

23-
inputs: str
24-
"""The text to embed."""
23+
inputs: Union[List[str], str]
24+
"""The text or list of texts to embed."""
2525
normalize: Optional[bool] = None
2626
prompt_name: Optional[str] = None
2727
"""The name of the prompt that should be used by for encoding. If not set, no prompt

src/huggingface_hub/inference/_generated/types/image_to_text.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ class ImageToTextGenerationParameters(BaseInferenceType):
7676
class ImageToTextParameters(BaseInferenceType):
7777
"""Additional inference parameters for Image To Text"""
7878

79+
generation_parameters: Optional[ImageToTextGenerationParameters] = None
80+
"""Parametrization of the text generation process"""
7981
max_new_tokens: Optional[int] = None
8082
"""The amount of maximum tokens to generate."""
81-
# Will be deprecated in the future when the renaming to `generation_parameters` is implemented in transformers
82-
generate_kwargs: Optional[ImageToTextGenerationParameters] = None
83-
"""Parametrization of the text generation process"""
8483

8584

8685
@dataclass

src/huggingface_hub/inference/_generated/types/text_to_audio.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ class TextToAudioGenerationParameters(BaseInferenceType):
7676
class TextToAudioParameters(BaseInferenceType):
7777
"""Additional inference parameters for Text To Audio"""
7878

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

8382

src/huggingface_hub/inference/_generated/types/text_to_image.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class TextToImageParameters(BaseInferenceType):
3535
"""Override the scheduler with a compatible one."""
3636
seed: Optional[int] = None
3737
"""Seed for the random number generator."""
38+
target_size: Optional[TextToImageTargetSize] = None
39+
"""The size in pixel of the output image"""
3840

3941

4042
@dataclass

src/huggingface_hub/inference/_generated/types/text_to_speech.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ class TextToSpeechGenerationParameters(BaseInferenceType):
7676
class TextToSpeechParameters(BaseInferenceType):
7777
"""Additional inference parameters for Text To Speech"""
7878

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

8382

0 commit comments

Comments
 (0)