hyped.core.ops.debug module¶
This module defines a collection of debug nodes for inspecting data within processing pipelines.
These nodes provide functionalities such as printing samples, logging information, and asserting conditions to aid in debugging and monitoring the flow and content of data as it moves through the pipeline.
- class hyped.core.ops.debug.PrintSample(*args: Any, **kwargs: Any)[source]¶
Bases:
BaseDebugNode[PrintSampleConfig]Debug node that prints the input feature with formatting.
This node takes positional and keyword arguments representing features and prints them to the console according to the format_string configuration. Features can be optionally indented if the indent configuration is set.
- async process(ctx: RunContext, **kwargs: Feature | Any | list[Any] | Scalar | Array) None[source]¶
Prints the input features to the console with specified formatting.
- Parameters:
ctx (RunContext) – Context object containing runtime information, including the rank and index of the current sample.
*args (Feature) – Positional features to be printed. These will be formatted based on their order in the
format_string.**kwargs (Feature) – Keyword features to be printed. These will be formatted based on their names in the
format_string.
- class hyped.core.ops.debug.PrintSampleConfig(*, format_string: str, indent: int | None = None)[source]¶
Bases:
BaseDebugNodeConfigConfiguration for the
PrintSamplenode.- format_string: str¶
The format string for printing.
This string uses standard Python formatting syntax to incorporate positional and keyword arguments passed to the node’s
process()method.
- indent: int | None¶
Number of spaces to use for indentation when printing feature arguments as JSON.
If
None, the raw feature will be printed. If an integer is provided, feature arguments will be serialized to JSON with that level of indentation before being formatted according toformat_string.
- model_config = {'extra': 'forbid', 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- hyped.core.ops.debug.print_(*args: Feature | Any | list[Any] | Scalar | Array, indent: int | None = None, **named_features: Feature | Any | list[Any] | Scalar | Array) None[source]¶
- hyped.core.ops.debug.print_(format: str, *feature: Feature | Any | list[Any] | Scalar | Array, indent: int | None = None, **named_features: Feature | Any | list[Any] | Scalar | Array) None
Prints provided features to the console with optional formatting and indentation.
This function creates and calls a
PrintSamplenode to print the provided features with optional formatting and indentation.There are two ways to call this function:
print_(*features: Feature, **named_features: Feature): Prints one or more features using a default format string where each positional feature is represented by"{}"and each keyword featurename=valueis represented by"{name}". An optional keyword-onlyindentcontrols JSON pretty-printing of the features.print_(format_string: str, *features: Feature, **named_features: Feature): Prints one or more features using the providedformat_string. Positional features are passed as positional arguments to the format string, and keyword features are passed as keyword arguments. An optional keyword-onlyindentcontrols JSON pretty-printing of the features.
- Parameters:
*args – Positional arguments. - The first argument can optionally be a
format_string. - Subsequent arguments are positional features (Feature) to be printed.indent – Keyword-only argument specifying the number of spaces to indent the output if the features are JSON serializable. Defaults to None (no indentation).
**kwargs – Keyword arguments representing named features (
Feature) to be printed. These can be referenced by their names in the format_string.