Hub Python Library documentation

Inference types

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Inference types

This page lists the types (e.g. dataclasses) available for each task supported on the Hugging Face Hub. Each task is specified using a JSON schema, and the types are generated from these schemas - with some customization due to Python requirements. Visit @huggingface.js/tasks to find the JSON schemas for each task.

This part of the lib is still under development and will be improved in future releases.

audio_classification

class huggingface_hub.AudioClassificationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.audio_classification.AudioClassificationParameters] = None )

Inputs for Audio Classification inference

class huggingface_hub.AudioClassificationOutputElement

< >

( label: str score: float )

Outputs for Audio Classification inference

class huggingface_hub.AudioClassificationParameters

< >

( function_to_apply: typing.Optional[ForwardRef('AudioClassificationOutputTransform')] = None top_k: typing.Optional[int] = None )

Additional inference parameters for Audio Classification

audio_to_audio

class huggingface_hub.AudioToAudioInput

< >

( inputs: typing.Any )

Inputs for Audio to Audio inference

class huggingface_hub.AudioToAudioOutputElement

< >

( blob: typing.Any content_type: str label: str )

Outputs of inference for the Audio To Audio task A generated audio file with its label.

automatic_speech_recognition

class huggingface_hub.AutomaticSpeechRecognitionGenerationParameters

< >

( do_sample: typing.Optional[bool] = None early_stopping: typing.Union[bool, ForwardRef('AutomaticSpeechRecognitionEarlyStoppingEnum'), NoneType] = None epsilon_cutoff: typing.Optional[float] = None eta_cutoff: typing.Optional[float] = None max_length: typing.Optional[int] = None max_new_tokens: typing.Optional[int] = None min_length: typing.Optional[int] = None min_new_tokens: typing.Optional[int] = None num_beam_groups: typing.Optional[int] = None num_beams: typing.Optional[int] = None penalty_alpha: typing.Optional[float] = None temperature: typing.Optional[float] = None top_k: typing.Optional[int] = None top_p: typing.Optional[float] = None typical_p: typing.Optional[float] = None use_cache: typing.Optional[bool] = None )

Parametrization of the text generation process

class huggingface_hub.AutomaticSpeechRecognitionInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.automatic_speech_recognition.AutomaticSpeechRecognitionParameters] = None )

Inputs for Automatic Speech Recognition inference

class huggingface_hub.AutomaticSpeechRecognitionOutput

< >

( text: str chunks: typing.Optional[typing.List[huggingface_hub.inference._generated.types.automatic_speech_recognition.AutomaticSpeechRecognitionOutputChunk]] = None )

Outputs of inference for the Automatic Speech Recognition task

class huggingface_hub.AutomaticSpeechRecognitionOutputChunk

< >

( text: str timestamps: typing.List[float] )

class huggingface_hub.AutomaticSpeechRecognitionParameters

< >

( generation_parameters: typing.Optional[huggingface_hub.inference._generated.types.automatic_speech_recognition.AutomaticSpeechRecognitionGenerationParameters] = None return_timestamps: typing.Optional[bool] = None )

Additional inference parameters for Automatic Speech Recognition

chat_completion

class huggingface_hub.ChatCompletionInput

< >

( messages: typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionInputMessage] frequency_penalty: typing.Optional[float] = None logit_bias: typing.Optional[typing.List[float]] = None logprobs: typing.Optional[bool] = None max_tokens: typing.Optional[int] = None model: typing.Optional[str] = None n: typing.Optional[int] = None presence_penalty: typing.Optional[float] = None response_format: typing.Optional[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionInputGrammarType] = None seed: typing.Optional[int] = None stop: typing.Optional[typing.List[str]] = None stream: typing.Optional[bool] = None stream_options: typing.Optional[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionInputStreamOptions] = None temperature: typing.Optional[float] = None tool_choice: typing.Union[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionInputToolChoiceClass, ForwardRef('ChatCompletionInputToolChoiceEnum'), NoneType] = None tool_prompt: typing.Optional[str] = None tools: typing.Optional[typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionInputTool]] = None top_logprobs: typing.Optional[int] = None top_p: typing.Optional[float] = None )

Chat Completion Input. Auto-generated from TGI specs. For more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.

class huggingface_hub.ChatCompletionInputFunctionDefinition

< >

( arguments: typing.Any name: str description: typing.Optional[str] = None )

class huggingface_hub.ChatCompletionInputFunctionName

< >

( name: str )

class huggingface_hub.ChatCompletionInputGrammarType

< >

( type: ChatCompletionInputGrammarTypeType value: typing.Any )

class huggingface_hub.ChatCompletionInputMessage

< >

( content: typing.Union[typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionInputMessageChunk], str] role: str name: typing.Optional[str] = None )

class huggingface_hub.ChatCompletionInputMessageChunk

< >

( type: ChatCompletionInputMessageChunkType image_url: typing.Optional[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionInputURL] = None text: typing.Optional[str] = None )

class huggingface_hub.ChatCompletionInputStreamOptions

< >

( include_usage: bool )

class huggingface_hub.ChatCompletionInputTool

< >

( function: ChatCompletionInputFunctionDefinition type: str )

class huggingface_hub.ChatCompletionInputToolChoiceClass

< >

( function: ChatCompletionInputFunctionName )

class huggingface_hub.ChatCompletionInputURL

< >

( url: str )

class huggingface_hub.ChatCompletionOutput

< >

( choices: typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionOutputComplete] created: int id: str model: str system_fingerprint: str usage: ChatCompletionOutputUsage )

Chat Completion Output. Auto-generated from TGI specs. For more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.

class huggingface_hub.ChatCompletionOutputComplete

< >

( finish_reason: str index: int message: ChatCompletionOutputMessage logprobs: typing.Optional[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionOutputLogprobs] = None )

class huggingface_hub.ChatCompletionOutputFunctionDefinition

< >

( arguments: typing.Any name: str description: typing.Optional[str] = None )

class huggingface_hub.ChatCompletionOutputLogprob

< >

( logprob: float token: str top_logprobs: typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionOutputTopLogprob] )

class huggingface_hub.ChatCompletionOutputLogprobs

< >

( content: typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionOutputLogprob] )

class huggingface_hub.ChatCompletionOutputMessage

< >

( role: str content: typing.Optional[str] = None tool_calls: typing.Optional[typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionOutputToolCall]] = None )

class huggingface_hub.ChatCompletionOutputToolCall

< >

( function: ChatCompletionOutputFunctionDefinition id: str type: str )

class huggingface_hub.ChatCompletionOutputTopLogprob

< >

( logprob: float token: str )

class huggingface_hub.ChatCompletionOutputUsage

< >

( completion_tokens: int prompt_tokens: int total_tokens: int )

class huggingface_hub.ChatCompletionStreamOutput

< >

( choices: typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionStreamOutputChoice] created: int id: str model: str system_fingerprint: str usage: typing.Optional[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionStreamOutputUsage] = None )

Chat Completion Stream Output. Auto-generated from TGI specs. For more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.

class huggingface_hub.ChatCompletionStreamOutputChoice

< >

( delta: ChatCompletionStreamOutputDelta index: int finish_reason: typing.Optional[str] = None logprobs: typing.Optional[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionStreamOutputLogprobs] = None )

class huggingface_hub.ChatCompletionStreamOutputDelta

< >

( role: str content: typing.Optional[str] = None tool_calls: typing.Optional[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionStreamOutputDeltaToolCall] = None )

class huggingface_hub.ChatCompletionStreamOutputDeltaToolCall

< >

( function: ChatCompletionStreamOutputFunction id: str index: int type: str )

class huggingface_hub.ChatCompletionStreamOutputFunction

< >

( arguments: str name: typing.Optional[str] = None )

class huggingface_hub.ChatCompletionStreamOutputLogprob

< >

( logprob: float token: str top_logprobs: typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionStreamOutputTopLogprob] )

class huggingface_hub.ChatCompletionStreamOutputLogprobs

< >

( content: typing.List[huggingface_hub.inference._generated.types.chat_completion.ChatCompletionStreamOutputLogprob] )

class huggingface_hub.ChatCompletionStreamOutputTopLogprob

< >

( logprob: float token: str )

class huggingface_hub.ChatCompletionStreamOutputUsage

< >

( completion_tokens: int prompt_tokens: int total_tokens: int )

depth_estimation

class huggingface_hub.DepthEstimationInput

< >

( inputs: typing.Any parameters: typing.Optional[typing.Dict[str, typing.Any]] = None )

Inputs for Depth Estimation inference

class huggingface_hub.DepthEstimationOutput

< >

( depth: typing.Any predicted_depth: typing.Any )

Outputs of inference for the Depth Estimation task

document_question_answering

class huggingface_hub.DocumentQuestionAnsweringInput

< >

( inputs: DocumentQuestionAnsweringInputData parameters: typing.Optional[huggingface_hub.inference._generated.types.document_question_answering.DocumentQuestionAnsweringParameters] = None )

Inputs for Document Question Answering inference

class huggingface_hub.DocumentQuestionAnsweringInputData

< >

( image: typing.Any question: str )

One (document, question) pair to answer

class huggingface_hub.DocumentQuestionAnsweringOutputElement

< >

( answer: str end: int score: float start: int )

Outputs of inference for the Document Question Answering task

class huggingface_hub.DocumentQuestionAnsweringParameters

< >

( doc_stride: typing.Optional[int] = None handle_impossible_answer: typing.Optional[bool] = None lang: typing.Optional[str] = None max_answer_len: typing.Optional[int] = None max_question_len: typing.Optional[int] = None max_seq_len: typing.Optional[int] = None top_k: typing.Optional[int] = None word_boxes: typing.Optional[typing.List[typing.Union[typing.List[float], str]]] = None )

Additional inference parameters for Document Question Answering

feature_extraction

class huggingface_hub.FeatureExtractionInput

< >

( inputs: str normalize: typing.Optional[bool] = None prompt_name: typing.Optional[str] = None truncate: typing.Optional[bool] = None truncation_direction: typing.Optional[ForwardRef('FeatureExtractionInputTruncationDirection')] = None )

Feature Extraction Input. Auto-generated from TEI specs. For more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tei-import.ts.

fill_mask

class huggingface_hub.FillMaskInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.fill_mask.FillMaskParameters] = None )

Inputs for Fill Mask inference

class huggingface_hub.FillMaskOutputElement

< >

( score: float sequence: str token: int token_str: typing.Any fill_mask_output_token_str: typing.Optional[str] = None )

Outputs of inference for the Fill Mask task

class huggingface_hub.FillMaskParameters

< >

( targets: typing.Optional[typing.List[str]] = None top_k: typing.Optional[int] = None )

Additional inference parameters for Fill Mask

image_classification

class huggingface_hub.ImageClassificationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.image_classification.ImageClassificationParameters] = None )

Inputs for Image Classification inference

class huggingface_hub.ImageClassificationOutputElement

< >

( label: str score: float )

Outputs of inference for the Image Classification task

class huggingface_hub.ImageClassificationParameters

< >

( function_to_apply: typing.Optional[ForwardRef('ImageClassificationOutputTransform')] = None top_k: typing.Optional[int] = None )

Additional inference parameters for Image Classification

image_segmentation

class huggingface_hub.ImageSegmentationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.image_segmentation.ImageSegmentationParameters] = None )

Inputs for Image Segmentation inference

class huggingface_hub.ImageSegmentationOutputElement

< >

( label: str mask: str score: typing.Optional[float] = None )

Outputs of inference for the Image Segmentation task A predicted mask / segment

class huggingface_hub.ImageSegmentationParameters

< >

( mask_threshold: typing.Optional[float] = None overlap_mask_area_threshold: typing.Optional[float] = None subtask: typing.Optional[ForwardRef('ImageSegmentationSubtask')] = None threshold: typing.Optional[float] = None )

Additional inference parameters for Image Segmentation

image_to_image

class huggingface_hub.ImageToImageInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.image_to_image.ImageToImageParameters] = None )

Inputs for Image To Image inference

class huggingface_hub.ImageToImageOutput

< >

( image: typing.Any )

Outputs of inference for the Image To Image task

class huggingface_hub.ImageToImageParameters

< >

( guidance_scale: typing.Optional[float] = None negative_prompt: typing.Optional[typing.List[str]] = None num_inference_steps: typing.Optional[int] = None target_size: typing.Optional[huggingface_hub.inference._generated.types.image_to_image.ImageToImageTargetSize] = None )

Additional inference parameters for Image To Image

class huggingface_hub.ImageToImageTargetSize

< >

( height: int width: int )

The size in pixel of the output image.

image_to_text

class huggingface_hub.ImageToTextGenerationParameters

< >

( do_sample: typing.Optional[bool] = None early_stopping: typing.Union[bool, ForwardRef('ImageToTextEarlyStoppingEnum'), NoneType] = None epsilon_cutoff: typing.Optional[float] = None eta_cutoff: typing.Optional[float] = None max_length: typing.Optional[int] = None max_new_tokens: typing.Optional[int] = None min_length: typing.Optional[int] = None min_new_tokens: typing.Optional[int] = None num_beam_groups: typing.Optional[int] = None num_beams: typing.Optional[int] = None penalty_alpha: typing.Optional[float] = None temperature: typing.Optional[float] = None top_k: typing.Optional[int] = None top_p: typing.Optional[float] = None typical_p: typing.Optional[float] = None use_cache: typing.Optional[bool] = None )

Parametrization of the text generation process

class huggingface_hub.ImageToTextInput

< >

( inputs: typing.Any parameters: typing.Optional[huggingface_hub.inference._generated.types.image_to_text.ImageToTextParameters] = None )

Inputs for Image To Text inference

class huggingface_hub.ImageToTextOutput

< >

( generated_text: typing.Any image_to_text_output_generated_text: typing.Optional[str] = None )

Outputs of inference for the Image To Text task

class huggingface_hub.ImageToTextParameters

< >

( generation_parameters: typing.Optional[huggingface_hub.inference._generated.types.image_to_text.ImageToTextGenerationParameters] = None max_new_tokens: typing.Optional[int] = None )

Additional inference parameters for Image To Text

object_detection

class huggingface_hub.ObjectDetectionBoundingBox

< >

( xmax: int xmin: int ymax: int ymin: int )

The predicted bounding box. Coordinates are relative to the top left corner of the input image.

class huggingface_hub.ObjectDetectionInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.object_detection.ObjectDetectionParameters] = None )

Inputs for Object Detection inference

class huggingface_hub.ObjectDetectionOutputElement

< >

( box: ObjectDetectionBoundingBox label: str score: float )

Outputs of inference for the Object Detection task

class huggingface_hub.ObjectDetectionParameters

< >

( threshold: typing.Optional[float] = None )

Additional inference parameters for Object Detection

question_answering

class huggingface_hub.QuestionAnsweringInput

< >

( inputs: QuestionAnsweringInputData parameters: typing.Optional[huggingface_hub.inference._generated.types.question_answering.QuestionAnsweringParameters] = None )

Inputs for Question Answering inference

class huggingface_hub.QuestionAnsweringInputData

< >

( context: str question: str )

One (context, question) pair to answer

class huggingface_hub.QuestionAnsweringOutputElement

< >

( answer: str end: int score: float start: int )

Outputs of inference for the Question Answering task

class huggingface_hub.QuestionAnsweringParameters

< >

( align_to_words: typing.Optional[bool] = None doc_stride: typing.Optional[int] = None handle_impossible_answer: typing.Optional[bool] = None max_answer_len: typing.Optional[int] = None max_question_len: typing.Optional[int] = None max_seq_len: typing.Optional[int] = None top_k: typing.Optional[int] = None )

Additional inference parameters for Question Answering

sentence_similarity

class huggingface_hub.SentenceSimilarityInput

< >

( inputs: SentenceSimilarityInputData parameters: typing.Optional[typing.Dict[str, typing.Any]] = None )

Inputs for Sentence similarity inference

class huggingface_hub.SentenceSimilarityInputData

< >

( sentences: typing.List[str] source_sentence: str )

summarization

class huggingface_hub.SummarizationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.summarization.SummarizationParameters] = None )

Inputs for Summarization inference

class huggingface_hub.SummarizationOutput

< >

( summary_text: str )

Outputs of inference for the Summarization task

class huggingface_hub.SummarizationParameters

< >

( clean_up_tokenization_spaces: typing.Optional[bool] = None generate_parameters: typing.Optional[typing.Dict[str, typing.Any]] = None truncation: typing.Optional[ForwardRef('SummarizationTruncationStrategy')] = None )

Additional inference parameters for summarization.

table_question_answering

class huggingface_hub.TableQuestionAnsweringInput

< >

( inputs: TableQuestionAnsweringInputData parameters: typing.Optional[huggingface_hub.inference._generated.types.table_question_answering.TableQuestionAnsweringParameters] = None )

Inputs for Table Question Answering inference

class huggingface_hub.TableQuestionAnsweringInputData

< >

( question: str table: typing.Dict[str, typing.List[str]] )

One (table, question) pair to answer

class huggingface_hub.TableQuestionAnsweringOutputElement

< >

( answer: str cells: typing.List[str] coordinates: typing.List[typing.List[int]] aggregator: typing.Optional[str] = None )

Outputs of inference for the Table Question Answering task

class huggingface_hub.TableQuestionAnsweringParameters

< >

( padding: typing.Optional[ForwardRef('Padding')] = None sequential: typing.Optional[bool] = None truncation: typing.Optional[bool] = None )

Additional inference parameters for Table Question Answering

text2text_generation

class huggingface_hub.Text2TextGenerationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.text2text_generation.Text2TextGenerationParameters] = None )

Inputs for Text2text Generation inference

class huggingface_hub.Text2TextGenerationOutput

< >

( generated_text: typing.Any text2_text_generation_output_generated_text: typing.Optional[str] = None )

Outputs of inference for the Text2text Generation task

class huggingface_hub.Text2TextGenerationParameters

< >

( clean_up_tokenization_spaces: typing.Optional[bool] = None generate_parameters: typing.Optional[typing.Dict[str, typing.Any]] = None truncation: typing.Optional[ForwardRef('Text2TextGenerationTruncationStrategy')] = None )

Additional inference parameters for Text2text Generation

text_classification

class huggingface_hub.TextClassificationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.text_classification.TextClassificationParameters] = None )

Inputs for Text Classification inference

class huggingface_hub.TextClassificationOutputElement

< >

( label: str score: float )

Outputs of inference for the Text Classification task

class huggingface_hub.TextClassificationParameters

< >

( function_to_apply: typing.Optional[ForwardRef('TextClassificationOutputTransform')] = None top_k: typing.Optional[int] = None )

Additional inference parameters for Text Classification

text_generation

class huggingface_hub.TextGenerationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.text_generation.TextGenerationInputGenerateParameters] = None stream: typing.Optional[bool] = None )

Text Generation Input. Auto-generated from TGI specs. For more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.

class huggingface_hub.TextGenerationInputGenerateParameters

< >

( adapter_id: typing.Optional[str] = None best_of: typing.Optional[int] = None decoder_input_details: typing.Optional[bool] = None details: typing.Optional[bool] = None do_sample: typing.Optional[bool] = None frequency_penalty: typing.Optional[float] = None grammar: typing.Optional[huggingface_hub.inference._generated.types.text_generation.TextGenerationInputGrammarType] = None max_new_tokens: typing.Optional[int] = None repetition_penalty: typing.Optional[float] = None return_full_text: typing.Optional[bool] = None seed: typing.Optional[int] = None stop: typing.Optional[typing.List[str]] = None temperature: typing.Optional[float] = None top_k: typing.Optional[int] = None top_n_tokens: typing.Optional[int] = None top_p: typing.Optional[float] = None truncate: typing.Optional[int] = None typical_p: typing.Optional[float] = None watermark: typing.Optional[bool] = None )

class huggingface_hub.TextGenerationInputGrammarType

< >

( type: TypeEnum value: typing.Any )

class huggingface_hub.TextGenerationOutput

< >

( generated_text: str details: typing.Optional[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputDetails] = None )

Text Generation Output. Auto-generated from TGI specs. For more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.

class huggingface_hub.TextGenerationOutputBestOfSequence

< >

( finish_reason: TextGenerationOutputFinishReason generated_text: str generated_tokens: int prefill: typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputPrefillToken] tokens: typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputToken] seed: typing.Optional[int] = None top_tokens: typing.Optional[typing.List[typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputToken]]] = None )

class huggingface_hub.TextGenerationOutputDetails

< >

( finish_reason: TextGenerationOutputFinishReason generated_tokens: int prefill: typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputPrefillToken] tokens: typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputToken] best_of_sequences: typing.Optional[typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputBestOfSequence]] = None seed: typing.Optional[int] = None top_tokens: typing.Optional[typing.List[typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationOutputToken]]] = None )

class huggingface_hub.TextGenerationOutputPrefillToken

< >

( id: int logprob: float text: str )

class huggingface_hub.TextGenerationOutputToken

< >

( id: int logprob: float special: bool text: str )

class huggingface_hub.TextGenerationStreamOutput

< >

( index: int token: TextGenerationStreamOutputToken details: typing.Optional[huggingface_hub.inference._generated.types.text_generation.TextGenerationStreamOutputStreamDetails] = None generated_text: typing.Optional[str] = None top_tokens: typing.Optional[typing.List[huggingface_hub.inference._generated.types.text_generation.TextGenerationStreamOutputToken]] = None )

Text Generation Stream Output. Auto-generated from TGI specs. For more details, check out https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.

class huggingface_hub.TextGenerationStreamOutputStreamDetails

< >

( finish_reason: TextGenerationOutputFinishReason generated_tokens: int input_length: int seed: typing.Optional[int] = None )

class huggingface_hub.TextGenerationStreamOutputToken

< >

( id: int logprob: float special: bool text: str )

text_to_audio

class huggingface_hub.TextToAudioGenerationParameters

< >

( do_sample: typing.Optional[bool] = None early_stopping: typing.Union[bool, ForwardRef('TextToAudioEarlyStoppingEnum'), NoneType] = None epsilon_cutoff: typing.Optional[float] = None eta_cutoff: typing.Optional[float] = None max_length: typing.Optional[int] = None max_new_tokens: typing.Optional[int] = None min_length: typing.Optional[int] = None min_new_tokens: typing.Optional[int] = None num_beam_groups: typing.Optional[int] = None num_beams: typing.Optional[int] = None penalty_alpha: typing.Optional[float] = None temperature: typing.Optional[float] = None top_k: typing.Optional[int] = None top_p: typing.Optional[float] = None typical_p: typing.Optional[float] = None use_cache: typing.Optional[bool] = None )

Parametrization of the text generation process

class huggingface_hub.TextToAudioInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.text_to_audio.TextToAudioParameters] = None )

Inputs for Text To Audio inference

class huggingface_hub.TextToAudioOutput

< >

( audio: typing.Any sampling_rate: typing.Any text_to_audio_output_sampling_rate: typing.Optional[float] = None )

Outputs of inference for the Text To Audio task

class huggingface_hub.TextToAudioParameters

< >

( generation_parameters: typing.Optional[huggingface_hub.inference._generated.types.text_to_audio.TextToAudioGenerationParameters] = None )

Additional inference parameters for Text To Audio

text_to_image

class huggingface_hub.TextToImageInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.text_to_image.TextToImageParameters] = None )

Inputs for Text To Image inference

class huggingface_hub.TextToImageOutput

< >

( image: typing.Any )

Outputs of inference for the Text To Image task

class huggingface_hub.TextToImageParameters

< >

( guidance_scale: typing.Optional[float] = None negative_prompt: typing.Optional[typing.List[str]] = None num_inference_steps: typing.Optional[int] = None scheduler: typing.Optional[str] = None seed: typing.Optional[int] = None target_size: typing.Optional[huggingface_hub.inference._generated.types.text_to_image.TextToImageTargetSize] = None )

Additional inference parameters for Text To Image

class huggingface_hub.TextToImageTargetSize

< >

( height: int width: int )

The size in pixel of the output image

text_to_speech

class huggingface_hub.TextToSpeechGenerationParameters

< >

( do_sample: typing.Optional[bool] = None early_stopping: typing.Union[bool, ForwardRef('TextToSpeechEarlyStoppingEnum'), NoneType] = None epsilon_cutoff: typing.Optional[float] = None eta_cutoff: typing.Optional[float] = None max_length: typing.Optional[int] = None max_new_tokens: typing.Optional[int] = None min_length: typing.Optional[int] = None min_new_tokens: typing.Optional[int] = None num_beam_groups: typing.Optional[int] = None num_beams: typing.Optional[int] = None penalty_alpha: typing.Optional[float] = None temperature: typing.Optional[float] = None top_k: typing.Optional[int] = None top_p: typing.Optional[float] = None typical_p: typing.Optional[float] = None use_cache: typing.Optional[bool] = None )

Parametrization of the text generation process

class huggingface_hub.TextToSpeechInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.text_to_speech.TextToSpeechParameters] = None )

Inputs for Text To Speech inference

class huggingface_hub.TextToSpeechOutput

< >

( audio: typing.Any sampling_rate: typing.Any text_to_speech_output_sampling_rate: typing.Optional[float] = None )

Outputs for Text to Speech inference Outputs of inference for the Text To Audio task

class huggingface_hub.TextToSpeechParameters

< >

( generation_parameters: typing.Optional[huggingface_hub.inference._generated.types.text_to_speech.TextToSpeechGenerationParameters] = None )

Additional inference parameters for Text To Speech

token_classification

class huggingface_hub.TokenClassificationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.token_classification.TokenClassificationParameters] = None )

Inputs for Token Classification inference

class huggingface_hub.TokenClassificationOutputElement

< >

( end: int score: float start: int word: str entity: typing.Optional[str] = None entity_group: typing.Optional[str] = None )

Outputs of inference for the Token Classification task

class huggingface_hub.TokenClassificationParameters

< >

( aggregation_strategy: typing.Optional[ForwardRef('TokenClassificationAggregationStrategy')] = None ignore_labels: typing.Optional[typing.List[str]] = None stride: typing.Optional[int] = None )

Additional inference parameters for Token Classification

translation

class huggingface_hub.TranslationInput

< >

( inputs: str parameters: typing.Optional[huggingface_hub.inference._generated.types.translation.TranslationParameters] = None )

Inputs for Translation inference

class huggingface_hub.TranslationOutput

< >

( translation_text: str )

Outputs of inference for the Translation task

class huggingface_hub.TranslationParameters

< >

( clean_up_tokenization_spaces: typing.Optional[bool] = None generate_parameters: typing.Optional[typing.Dict[str, typing.Any]] = None src_lang: typing.Optional[str] = None tgt_lang: typing.Optional[str] = None truncation: typing.Optional[ForwardRef('TranslationTruncationStrategy')] = None )

Additional inference parameters for Translation

video_classification

class huggingface_hub.VideoClassificationInput

< >

( inputs: typing.Any parameters: typing.Optional[huggingface_hub.inference._generated.types.video_classification.VideoClassificationParameters] = None )

Inputs for Video Classification inference

class huggingface_hub.VideoClassificationOutputElement

< >

( label: str score: float )

Outputs of inference for the Video Classification task

class huggingface_hub.VideoClassificationParameters

< >

( frame_sampling_rate: typing.Optional[int] = None function_to_apply: typing.Optional[ForwardRef('VideoClassificationOutputTransform')] = None num_frames: typing.Optional[int] = None top_k: typing.Optional[int] = None )

Additional inference parameters for Video Classification

visual_question_answering

class huggingface_hub.VisualQuestionAnsweringInput

< >

( inputs: VisualQuestionAnsweringInputData parameters: typing.Optional[huggingface_hub.inference._generated.types.visual_question_answering.VisualQuestionAnsweringParameters] = None )

Inputs for Visual Question Answering inference

class huggingface_hub.VisualQuestionAnsweringInputData

< >

( image: typing.Any question: typing.Any )

One (image, question) pair to answer

class huggingface_hub.VisualQuestionAnsweringOutputElement

< >

( score: float answer: typing.Optional[str] = None )

Outputs of inference for the Visual Question Answering task

class huggingface_hub.VisualQuestionAnsweringParameters

< >

( top_k: typing.Optional[int] = None )

Additional inference parameters for Visual Question Answering

zero_shot_classification

class huggingface_hub.ZeroShotClassificationInput

< >

( inputs: str parameters: ZeroShotClassificationParameters )

Inputs for Zero Shot Classification inference

class huggingface_hub.ZeroShotClassificationOutputElement

< >

( label: str score: float )

Outputs of inference for the Zero Shot Classification task

class huggingface_hub.ZeroShotClassificationParameters

< >

( candidate_labels: typing.List[str] hypothesis_template: typing.Optional[str] = None multi_label: typing.Optional[bool] = None )

Additional inference parameters for Zero Shot Classification

zero_shot_image_classification

class huggingface_hub.ZeroShotImageClassificationInput

< >

( inputs: str parameters: ZeroShotImageClassificationParameters )

Inputs for Zero Shot Image Classification inference

class huggingface_hub.ZeroShotImageClassificationOutputElement

< >

( label: str score: float )

Outputs of inference for the Zero Shot Image Classification task

class huggingface_hub.ZeroShotImageClassificationParameters

< >

( candidate_labels: typing.List[str] hypothesis_template: typing.Optional[str] = None )

Additional inference parameters for Zero Shot Image Classification

zero_shot_object_detection

class huggingface_hub.ZeroShotObjectDetectionBoundingBox

< >

( xmax: int xmin: int ymax: int ymin: int )

The predicted bounding box. Coordinates are relative to the top left corner of the input image.

class huggingface_hub.ZeroShotObjectDetectionInput

< >

( inputs: str parameters: ZeroShotObjectDetectionParameters )

Inputs for Zero Shot Object Detection inference

class huggingface_hub.ZeroShotObjectDetectionOutputElement

< >

( box: ZeroShotObjectDetectionBoundingBox label: str score: float )

Outputs of inference for the Zero Shot Object Detection task

class huggingface_hub.ZeroShotObjectDetectionParameters

< >

( candidate_labels: typing.List[str] )

Additional inference parameters for Zero Shot Object Detection

< > Update on GitHub