Module: hf_types
HFClassificationInferenceInput
Bases: HFInferenceBaseInput
Input data for classification models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text to classify |
required |
Source code in src/infernet_ml/utils/hf_types.py
HFDiffusionInferenceInput
Bases: HFInferenceBaseInput
Input data for diffusion models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt |
str
|
Text prompt for image generation |
required |
negative_prompt |
Optional[str]
|
Negative text prompt for the model |
required |
height |
Optional[int]
|
Height in pixels of the image to generate. Default 512. |
required |
width |
Optional[int]
|
Width in pixels of the image to generate. Default 512. |
required |
num_inference_steps |
Optional[int]
|
Number of denoising steps. More steps --> higher quality but slower inference. |
required |
guidance_scale |
Optional[float]
|
Guidance scale for the model to control the influence of the prompt on the generated image. Higher values --> more influence of the prompt on the generated image but may lead to lower image quality. Default values are model dependent but usually between 7 and 8. |
required |
Source code in src/infernet_ml/utils/hf_types.py
HFInferenceBaseInput
HFSummarizationConfig
Bases: TypedDict
Summarization model configuration
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
str
|
Model name |
required |
max_length |
int
|
Maximum length in tokens of the generated summary |
required |
min_length |
int
|
Minimum length in tokens of the generated summary |
required |
top_k |
int
|
Number of top tokens to sample from |
required |
top_p |
float
|
Cumulative probability for top-k sampling |
required |
temperature |
float
|
Temperature for sampling. Default 1.0 |
required |
repetition_penalty |
float
|
Repetition penalty for beam search |
required |
num_return_sequences |
int
|
Number of sequences to return |
required |
use_cache |
bool
|
Whether to use cache during inference |
required |
Source code in src/infernet_ml/utils/hf_types.py
HFSummarizationInferenceInput
Bases: HFInferenceBaseInput
Input data for summarization models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text to summarize |
required |
parameters |
Optional[HFSummarizationConfig]
|
Summarization model |
required |
Source code in src/infernet_ml/utils/hf_types.py
HFTaskId
Bases: IntEnum
Hugging Face task types
Parameters:
Name | Type | Description | Default |
---|---|---|---|
UNSET |
int
|
Unset task |
required |
TEXT_GENERATION |
int
|
Text generation task |
required |
TEXT_CLASSIFICATION |
int
|
Text classification task |
required |
TOKEN_CLASSIFICATION |
int
|
Token classification task |
required |
SUMMARIZATION |
int
|
Summarization task |
required |
TEXT_TO_IMAGE |
int
|
Text to image task |
required |
Source code in src/infernet_ml/utils/hf_types.py
HFTextGenerationInferenceInput
Bases: HFInferenceBaseInput
Input data for text generation models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt |
str
|
Prompt for text generation |
required |
details |
bool
|
Whether to return detailed output (tokens, probabilities, seed, finish reason, etc.) |
required |
stream |
bool
|
Whether to stream output. Only available for models
running with the |
required |
do_sample |
bool
|
Whether to use logits sampling |
required |
max_new_tokens |
int
|
Maximum number of tokens to generate |
required |
best_of |
int
|
Number of best sequences to generate and return with highest token logprobs |
required |
repetition_penalty |
float
|
Repetition penalty for greedy decoding. 1.0 is no penalty |
required |
return_full_text |
bool
|
Whether to preprend the prompt to the generated text |
required |
seed |
int
|
Random seed for generation sampling |
required |
stop_sequences |
str
|
Sequence to stop generation if a member of
|
required |
temperature |
float
|
Sampling temperature for logits sampling |
required |
top_k |
int
|
Number of highest probability vocabulary tokens to keep for top-k sampling |
required |
top_p |
float
|
If <1, only the most probable tokens with probabilities that add
up to |
required |
truncate |
int
|
Truncate input to this length if set |
required |
typical_p |
float
|
Typical decoding mass. |
required |
watermark |
bool
|
Whether to add a watermark to the generated text Defaults to False. |
required |
decoder_input_details |
bool
|
Whether to return the decoder input token
logprobs and ids. Requires |
required |
Source code in src/infernet_ml/utils/hf_types.py
HFTokenClassificationInferenceInput
Bases: HFInferenceBaseInput
Input data for token classification models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text to classify |
required |
Source code in src/infernet_ml/utils/hf_types.py
parse_hf_inference_input_from_dict(r)
Parse input data from dictionary