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 Nov 15, 2024
1 parent 218709a commit 8149425
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class AudioClassificationParameters(BaseInferenceType):
"""

function_to_apply: Optional["AudioClassificationOutputTransform"] = None
"""The function to apply to the output."""
top_k: Optional[int] = None
"""When specified, limits the output to the top K most probable classes."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AutomaticSpeechRecognitionParameters(BaseInferenceType):
Additional inference parameters for Automatic Speech Recognition
"""

generate: Optional[AutomaticSpeechRecognitionGenerationParameters] = None
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"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class ImageClassificationParameters(BaseInferenceType):
"""

function_to_apply: Optional["ImageClassificationOutputTransform"] = None
"""The function to apply to the output."""
top_k: Optional[int] = None
"""When specified, limits the output to the top K most probable classes."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ImageToTextParameters(BaseInferenceType):
Additional inference parameters for Image To Text
"""

generate: Optional[ImageToTextGenerationParameters] = None
generation_parameters: Optional[ImageToTextGenerationParameters] = None
"""Parametrization of the text generation process"""
max_new_tokens: Optional[int] = None
"""The amount of maximum tokens to generate."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@

@dataclass
class TextClassificationParameters(BaseInferenceType):
"""
Additional inference parameters for Text Classification.
"""Additional inference parameters
Additional inference parameters for Text Classification
"""

function_to_apply: Optional["TextClassificationOutputTransform"] = None
"""
The function to apply to the output.
"""
top_k: Optional[int] = None
"""
When specified, limits the output to the top K most probable classes.
"""
"""When specified, limits the output to the top K most probable classes."""


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class TextToAudioGenerationParameters(BaseInferenceType):
max_length: Optional[int] = None
"""The maximum length (in tokens) of the generated text, including the input."""
max_new_tokens: Optional[int] = None
"""The maximum number of tokens to generate. Takes precedence over maxLength."""
"""The maximum number of tokens to generate. Takes precedence over max_length."""
min_length: Optional[int] = None
"""The minimum length (in tokens) of the generated text, including the input."""
min_new_tokens: Optional[int] = None
"""The minimum number of tokens to generate. Takes precedence over maxLength."""
"""The minimum number of tokens to generate. Takes precedence over min_length."""
num_beam_groups: Optional[int] = None
"""Number of groups to divide num_beams into in order to ensure diversity among different
groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
Expand Down Expand Up @@ -80,7 +80,7 @@ class TextToAudioParameters(BaseInferenceType):
Additional inference parameters for Text To Audio
"""

generate: 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 @@ -40,11 +40,11 @@ class TextToSpeechGenerationParameters(BaseInferenceType):
max_length: Optional[int] = None
"""The maximum length (in tokens) of the generated text, including the input."""
max_new_tokens: Optional[int] = None
"""The maximum number of tokens to generate. Takes precedence over maxLength."""
"""The maximum number of tokens to generate. Takes precedence over max_length."""
min_length: Optional[int] = None
"""The minimum length (in tokens) of the generated text, including the input."""
min_new_tokens: Optional[int] = None
"""The minimum number of tokens to generate. Takes precedence over maxLength."""
"""The minimum number of tokens to generate. Takes precedence over min_length."""
num_beam_groups: Optional[int] = None
"""Number of groups to divide num_beams into in order to ensure diversity among different
groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
Expand Down Expand Up @@ -80,7 +80,7 @@ class TextToSpeechParameters(BaseInferenceType):
Additional inference parameters for Text To Speech
"""

generate: Optional[TextToSpeechGenerationParameters] = None
generation_parameters: Optional[TextToSpeechGenerationParameters] = None
"""Parametrization of the text generation process"""


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 Any, List, Literal, Optional
from typing import List, Literal, Optional

from .base import BaseInferenceType

Expand Down Expand Up @@ -40,14 +40,15 @@ class TokenClassificationInput(BaseInferenceType):
class TokenClassificationOutputElement(BaseInferenceType):
"""Outputs of inference for the Token Classification task"""

label: Any
end: int
"""The character position in the input where this group ends."""
score: float
"""The associated score / probability"""
end: Optional[int] = None
"""The character position in the input where this group ends."""
entity_group: Optional[str] = None
"""The predicted label for that group of tokens"""
start: Optional[int] = None
start: int
"""The character position in the input where this group begins."""
word: Optional[str] = None
word: str
"""The corresponding text"""
entity: Optional[str] = None
"""The predicted label for a single token"""
entity_group: Optional[str] = None
"""The predicted label for a group of one or more tokens"""
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class VisualQuestionAnsweringInput(BaseInferenceType):
class VisualQuestionAnsweringOutputElement(BaseInferenceType):
"""Outputs of inference for the Visual Question Answering task"""

label: Any
score: float
"""The associated score / probability"""
answer: Optional[str] = None
Expand Down

0 comments on commit 8149425

Please sign in to comment.