validators
¶
Common validators for pipeline stage verification.
This module provides reusable validation functions that can be used across all pipeline stages for input/output verification.
Classes¶
fastvideo.pipelines.stages.validators.StageValidators
¶
Common validators for pipeline stages.
Functions¶
fastvideo.pipelines.stages.validators.StageValidators.bool_value
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.divisible
staticmethod
¶
Return a validator that checks if value is divisible by divisor.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.divisible_by
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.generator_or_list_generators
staticmethod
¶
Check if value is a Generator or list of Generators.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.is_list
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.is_tensor
staticmethod
¶
Check if value is a torch tensor and doesn't contain NaN values.
fastvideo.pipelines.stages.validators.StageValidators.is_tuple
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.list_length
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.list_min_length
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.list_not_empty
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.list_of_tensors
staticmethod
¶
Check if value is a non-empty list where all items are tensors without NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.list_of_tensors_dims
staticmethod
¶
Return a validator that checks if value is a list of tensors with specific dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.list_of_tensors_min_dims
staticmethod
¶
Return a validator that checks if value is a list of tensors with at least min_dims dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.list_of_tensors_with_dims
staticmethod
¶
Check if value is a non-empty list where all items are tensors with specific dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.list_of_tensors_with_min_dims
staticmethod
¶
Check if value is a non-empty list where all items are tensors with at least min_dims dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.min_dims
staticmethod
¶
Return a validator that checks if tensor has at least min_dims dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.non_negative_float
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.none_or_list
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.none_or_positive_int
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.none_or_tensor
staticmethod
¶
Check if value is None or a tensor without NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.none_or_tensor_with_dims
staticmethod
¶
Return a validator that checks if value is None or a tensor with specific dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.not_none
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.positive_float
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.positive_int
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.positive_int_divisible
staticmethod
¶
Return a validator that checks if value is a positive integer divisible by divisor.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.string_not_empty
staticmethod
¶
fastvideo.pipelines.stages.validators.StageValidators.string_or_list_strings
staticmethod
¶
Check if value is a string or list of strings.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.tensor_min_dims
staticmethod
¶
Check if value is a tensor with at least min_dims dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.tensor_shape_matches
staticmethod
¶
Check if tensor shape matches expected shape (None for any size) and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.tensor_with_dims
staticmethod
¶
Check if value is a tensor with specific dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.StageValidators.with_dims
staticmethod
¶
Return a validator that checks if tensor has specific dimensions and no NaN values.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.ValidationFailure
¶
ValidationFailure(validator_name: str, actual_value: Any, expected: str | None = None, error_msg: str | None = None)
Details about a specific validation failure.
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.VerificationResult
¶
Wrapper class for stage verification results.
Source code in fastvideo/pipelines/stages/validators.py
Functions¶
fastvideo.pipelines.stages.validators.VerificationResult.add_check
¶
add_check(field_name: str, value: Any, validators: Callable[[Any], bool] | list[Callable[[Any], bool]]) -> VerificationResult
Add a validation check for a field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field_name
|
str
|
Name of the field being checked |
required |
value
|
Any
|
The actual value to validate |
required |
validators
|
Callable[[Any], bool] | list[Callable[[Any], bool]]
|
Single validation function or list of validation functions. Each function will be called with the value as its first argument. |
required |
Returns:
| Type | Description |
|---|---|
VerificationResult
|
Self for method chaining |
Examples:
Single validator¶
result.add_check("tensor", my_tensor, V.is_tensor)
Multiple validators (all must pass)¶
result.add_check("latents", batch.latents, [V.is_tensor, V.with_dims(5)])
Using partial functions for parameters¶
result.add_check("height", batch.height, [V.not_none, V.divisible(8)])
Source code in fastvideo/pipelines/stages/validators.py
fastvideo.pipelines.stages.validators.VerificationResult.get_detailed_failures
¶
get_detailed_failures() -> dict[str, list[ValidationFailure]]
fastvideo.pipelines.stages.validators.VerificationResult.get_failed_fields
¶
fastvideo.pipelines.stages.validators.VerificationResult.get_failure_summary
¶
get_failure_summary() -> str
Get a comprehensive summary of all validation failures.