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: Any parameters: Optional )

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: Optional top_k: Optional )

Additional inference parameters Additional inference parameters for Audio Classification

audio_to_audio

class huggingface_hub.AudioToAudioInput

< >

( inputs: Any )

Inputs for Audio to Audio inference

class huggingface_hub.AudioToAudioOutputElement

< >

( blob: 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.AutomaticSpeechRecognitionInput

< >

( inputs: Any parameters: Optional )

Inputs for Automatic Speech Recognition inference

class huggingface_hub.AutomaticSpeechRecognitionOutput

< >

( text: str chunks: Optional )

Outputs of inference for the Automatic Speech Recognition task

class huggingface_hub.AutomaticSpeechRecognitionOutputChunk

< >

( text: str timestamps: List )

class huggingface_hub.AutomaticSpeechRecognitionParameters

< >

( generate: Optional return_timestamps: Optional )

Additional inference parameters Additional inference parameters for Automatic Speech Recognition

class huggingface_hub.GenerationParameters

< >

( do_sample: Optional early_stopping: Union epsilon_cutoff: Optional eta_cutoff: Optional max_length: Optional max_new_tokens: Optional min_length: Optional min_new_tokens: Optional num_beam_groups: Optional num_beams: Optional penalty_alpha: Optional temperature: Optional top_k: Optional top_p: Optional typical_p: Optional use_cache: Optional )

Parametrization of the text generation process Ad-hoc parametrization of the text generation process

depth_estimation

class huggingface_hub.DepthEstimationInput

< >

( inputs: Any parameters: Optional )

Inputs for Depth Estimation inference

class huggingface_hub.DepthEstimationOutput

< >

( depth: Any predicted_depth: Any )

Outputs of inference for the Depth Estimation task

document_question_answering

class huggingface_hub.DocumentQuestionAnsweringInput

< >

( inputs: DocumentQuestionAnsweringInputData parameters: Optional )

Inputs for Document Question Answering inference

class huggingface_hub.DocumentQuestionAnsweringInputData

< >

( image: Any question: str )

One (document, question) pair to answer

class huggingface_hub.DocumentQuestionAnsweringOutputElement

< >

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

Outputs of inference for the Document Question Answering task

class huggingface_hub.DocumentQuestionAnsweringParameters

< >

( doc_stride: Optional handle_impossible_answer: Optional lang: Optional max_answer_len: Optional max_question_len: Optional max_seq_len: Optional top_k: Optional word_boxes: Optional )

Additional inference parameters Additional inference parameters for Document Question Answering

feature_extraction

class huggingface_hub.FeatureExtractionInput

< >

( inputs: str parameters: Optional )

Inputs for Text Embedding inference

fill_mask

class huggingface_hub.FillMaskInput

< >

( inputs: str parameters: Optional )

Inputs for Fill Mask inference

class huggingface_hub.FillMaskOutputElement

< >

( score: float sequence: str token: int token_str: Any fill_mask_output_token_str: Optional )

Outputs of inference for the Fill Mask task

class huggingface_hub.FillMaskParameters

< >

( targets: Optional top_k: Optional )

Additional inference parameters Additional inference parameters for Fill Mask

image_classification

class huggingface_hub.ImageClassificationInput

< >

( inputs: Any parameters: Optional )

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: Optional top_k: Optional )

Additional inference parameters Additional inference parameters for Image Classification

image_segmentation

class huggingface_hub.ImageSegmentationInput

< >

( inputs: Any parameters: Optional )

Inputs for Image Segmentation inference

class huggingface_hub.ImageSegmentationOutputElement

< >

( label: str mask: Any score: Optional )

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

class huggingface_hub.ImageSegmentationParameters

< >

( mask_threshold: Optional overlap_mask_area_threshold: Optional subtask: Optional threshold: Optional )

Additional inference parameters Additional inference parameters for Image Segmentation

image_to_image

class huggingface_hub.ImageToImageInput

< >

( inputs: Any parameters: Optional )

Inputs for Image To Image inference

class huggingface_hub.ImageToImageOutput

< >

( image: Any )

Outputs of inference for the Image To Image task

class huggingface_hub.ImageToImageParameters

< >

( guidance_scale: Optional negative_prompt: Optional num_inference_steps: Optional target_size: Optional )

Additional inference parameters Additional inference parameters for Image To Image

class huggingface_hub.TargetSize

< >

( height: int width: int )

The size in pixel of the output image

image_to_text

class huggingface_hub.GenerationParameters

< >

( do_sample: Optional early_stopping: Union epsilon_cutoff: Optional eta_cutoff: Optional max_length: Optional max_new_tokens: Optional min_length: Optional min_new_tokens: Optional num_beam_groups: Optional num_beams: Optional penalty_alpha: Optional temperature: Optional top_k: Optional top_p: Optional typical_p: Optional use_cache: Optional )

Parametrization of the text generation process Ad-hoc parametrization of the text generation process

class huggingface_hub.ImageToTextInput

< >

( inputs: Any parameters: Optional )

Inputs for Image To Text inference

class huggingface_hub.ImageToTextOutput

< >

( generated_text: Any image_to_text_output_generated_text: Optional )

Outputs of inference for the Image To Text task

class huggingface_hub.ImageToTextParameters

< >

( generate: Optional max_new_tokens: Optional )

Additional inference parameters Additional inference parameters for Image To Text

object_detection

class huggingface_hub.BoundingBox

< >

( 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: Any parameters: Optional )

Inputs for Object Detection inference

class huggingface_hub.ObjectDetectionOutputElement

< >

( box: BoundingBox label: str score: float )

Outputs of inference for the Object Detection task

class huggingface_hub.ObjectDetectionParameters

< >

( threshold: Optional )

Additional inference parameters Additional inference parameters for Object Detection

question_answering

class huggingface_hub.QuestionAnsweringInput

< >

( inputs: QuestionAnsweringInputData parameters: Optional )

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: Optional doc_stride: Optional handle_impossible_answer: Optional max_answer_len: Optional max_question_len: Optional max_seq_len: Optional top_k: Optional )

Additional inference parameters Additional inference parameters for Question Answering

sentence_similarity

class huggingface_hub.SentenceSimilarityInput

< >

( inputs: SentenceSimilarityInputData parameters: Optional )

Inputs for Sentence similarity inference

class huggingface_hub.SentenceSimilarityInputData

< >

( sentences: List source_sentence: str )

summarization

class huggingface_hub.SummarizationInput

< >

( inputs: str parameters: Optional )

Inputs for Summarization inference Inputs for Text2text Generation inference

class huggingface_hub.SummarizationOutput

< >

( summary_text: Any summarization_output_summary_text: Optional )

Outputs for Summarization inference Outputs of inference for the Text2text Generation task

class huggingface_hub.Text2TextGenerationParameters

< >

( clean_up_tokenization_spaces: Optional generate_parameters: Optional truncation: Optional )

Additional inference parameters Additional inference parameters for Text2text Generation

table_question_answering

class huggingface_hub.TableQuestionAnsweringInput

< >

( inputs: TableQuestionAnsweringInputData parameters: Optional )

Inputs for Table Question Answering inference

class huggingface_hub.TableQuestionAnsweringInputData

< >

( question: str table: Dict )

One (table, question) pair to answer

class huggingface_hub.TableQuestionAnsweringOutputElement

< >

( answer: str cells: List coordinates: List aggregator: Optional )

Outputs of inference for the Table Question Answering task

text2text_generation

class huggingface_hub.Text2TextGenerationInput

< >

( inputs: str parameters: Optional )

Inputs for Text2text Generation inference

class huggingface_hub.Text2TextGenerationOutput

< >

( generated_text: Any text2_text_generation_output_generated_text: Optional )

Outputs of inference for the Text2text Generation task

class huggingface_hub.Text2TextGenerationParameters

< >

( clean_up_tokenization_spaces: Optional generate_parameters: Optional truncation: Optional )

Additional inference parameters Additional inference parameters for Text2text Generation

text_classification

class huggingface_hub.TextClassificationInput

< >

( inputs: str parameters: Optional )

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: Optional top_k: Optional )

Additional inference parameters Additional inference parameters for Text Classification

text_generation

class huggingface_hub.PrefillToken

< >

( id: int logprob: float text: str )

class huggingface_hub.TextGenerationInput

< >

( inputs: str parameters: Optional )

Inputs for Text Generation inference

class huggingface_hub.TextGenerationOutput

< >

( generated_text: str details: Optional )

Outputs for Text Generation inference

class huggingface_hub.TextGenerationOutputDetails

< >

( finish_reason: FinishReason generated_tokens: int prefill: List tokens: List best_of_sequences: Optional seed: Optional )

When enabled, details about the generation

class huggingface_hub.TextGenerationParameters

< >

( best_of: Optional decoder_input_details: Optional details: Optional do_sample: Optional max_new_tokens: Optional repetition_penalty: Optional return_full_text: Optional seed: Optional stop_sequences: Optional temperature: Optional top_k: Optional top_p: Optional truncate: Optional typical_p: Optional watermark: Optional )

Additional inference parameters Additional inference parameters for Text Generation

class huggingface_hub.TextGenerationSequenceDetails

< >

( finish_reason: FinishReason generated_text: int generated_tokens: int prefill: List tokens: List seed: Optional )

class huggingface_hub.Token

< >

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

text_to_audio

class huggingface_hub.GenerationParameters

< >

( do_sample: Optional early_stopping: Union epsilon_cutoff: Optional eta_cutoff: Optional max_length: Optional max_new_tokens: Optional min_length: Optional min_new_tokens: Optional num_beam_groups: Optional num_beams: Optional penalty_alpha: Optional temperature: Optional top_k: Optional top_p: Optional typical_p: Optional use_cache: Optional )

Parametrization of the text generation process Ad-hoc parametrization of the text generation process

class huggingface_hub.TextToAudioInput

< >

( inputs: str parameters: Optional )

Inputs for Text To Audio inference

class huggingface_hub.TextToAudioOutput

< >

( audio: Any sampling_rate: Any text_to_audio_output_sampling_rate: Optional )

Outputs of inference for the Text To Audio task

class huggingface_hub.TextToAudioParameters

< >

( generate: Optional )

Additional inference parameters Additional inference parameters for Text To Audio

text_to_image

class huggingface_hub.TargetSize

< >

( height: int width: int )

The size in pixel of the output image

class huggingface_hub.TextToImageInput

< >

( inputs: str parameters: Optional )

Inputs for Text To Image inference

class huggingface_hub.TextToImageOutput

< >

( image: Any )

Outputs of inference for the Text To Image task

class huggingface_hub.TextToImageParameters

< >

( guidance_scale: Optional negative_prompt: Optional num_inference_steps: Optional scheduler: Optional target_size: Optional )

Additional inference parameters Additional inference parameters for Text To Image

text_to_speech

class huggingface_hub.GenerationParameters

< >

( do_sample: Optional early_stopping: Union epsilon_cutoff: Optional eta_cutoff: Optional max_length: Optional max_new_tokens: Optional min_length: Optional min_new_tokens: Optional num_beam_groups: Optional num_beams: Optional penalty_alpha: Optional temperature: Optional top_k: Optional top_p: Optional typical_p: Optional use_cache: Optional )

Parametrization of the text generation process Ad-hoc parametrization of the text generation process

class huggingface_hub.TextToAudioParameters

< >

( generate: Optional )

Additional inference parameters Additional inference parameters for Text To Audio

class huggingface_hub.TextToSpeechInput

< >

( inputs: str parameters: Optional )

Inputs for Text to Speech inference Inputs for Text To Audio inference

class huggingface_hub.TextToSpeechOutput

< >

( audio: Any sampling_rate: Any text_to_speech_output_sampling_rate: Optional )

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

token_classification

class huggingface_hub.TokenClassificationInput

< >

( inputs: str parameters: Optional )

Inputs for Token Classification inference

class huggingface_hub.TokenClassificationOutputElement

< >

( label: Any score: float end: Optional entity_group: Optional start: Optional word: Optional )

Outputs of inference for the Token Classification task

class huggingface_hub.TokenClassificationParameters

< >

( aggregation_strategy: Optional ignore_labels: Optional stride: Optional )

Additional inference parameters Additional inference parameters for Token Classification

translation

class huggingface_hub.Text2TextGenerationParameters

< >

( clean_up_tokenization_spaces: Optional generate_parameters: Optional truncation: Optional )

Additional inference parameters Additional inference parameters for Text2text Generation

class huggingface_hub.TranslationInput

< >

( inputs: str parameters: Optional )

Inputs for Translation inference Inputs for Text2text Generation inference

class huggingface_hub.TranslationOutput

< >

( translation_text: Any translation_output_translation_text: Optional )

Outputs for Translation inference Outputs of inference for the Text2text Generation task

video_classification

class huggingface_hub.VideoClassificationInput

< >

( inputs: Any parameters: Optional )

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: Optional function_to_apply: Optional num_frames: Optional top_k: Optional )

Additional inference parameters Additional inference parameters for Video Classification

visual_question_answering

class huggingface_hub.VisualQuestionAnsweringInput

< >

( inputs: VisualQuestionAnsweringInputData parameters: Optional )

Inputs for Visual Question Answering inference

class huggingface_hub.VisualQuestionAnsweringInputData

< >

( image: Any question: Any )

One (image, question) pair to answer

class huggingface_hub.VisualQuestionAnsweringOutputElement

< >

( label: Any score: float answer: Optional )

Outputs of inference for the Visual Question Answering task

class huggingface_hub.VisualQuestionAnsweringParameters

< >

( top_k: Optional )

Additional inference parameters Additional inference parameters for Visual Question Answering

zero_shot_classification

class huggingface_hub.ZeroShotClassificationInput

< >

( inputs: ZeroShotClassificationInputData parameters: Optional )

Inputs for Zero Shot Classification inference

class huggingface_hub.ZeroShotClassificationInputData

< >

( candidate_labels: List text: str )

The input text data, with candidate labels

class huggingface_hub.ZeroShotClassificationOutputElement

< >

( label: str score: float )

Outputs of inference for the Zero Shot Classification task

class huggingface_hub.ZeroShotClassificationParameters

< >

( hypothesis_template: Optional multi_label: Optional )

Additional inference parameters Additional inference parameters for Zero Shot Classification

zero_shot_image_classification

class huggingface_hub.ZeroShotImageClassificationInput

< >

( inputs: ZeroShotImageClassificationInputData parameters: Optional )

Inputs for Zero Shot Image Classification inference

class huggingface_hub.ZeroShotImageClassificationInputData

< >

( candidate_labels: List image: Any )

The input image data, with candidate labels

class huggingface_hub.ZeroShotImageClassificationOutputElement

< >

( label: str score: float )

Outputs of inference for the Zero Shot Image Classification task

class huggingface_hub.ZeroShotImageClassificationParameters

< >

( hypothesis_template: Optional )

Additional inference parameters Additional inference parameters for Zero Shot Image Classification

zero_shot_object_detection

class huggingface_hub.BoundingBox

< >

( 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: ZeroShotObjectDetectionInputData parameters: Optional )

Inputs for Zero Shot Object Detection inference

class huggingface_hub.ZeroShotObjectDetectionInputData

< >

( candidate_labels: List image: Any )

The input image data, with candidate labels

class huggingface_hub.ZeroShotObjectDetectionOutputElement

< >

( box: BoundingBox label: str score: float )

Outputs of inference for the Zero Shot Object Detection task