nemo_rl.utils.multimodal_payload_metrics#

Module Contents#

Functions#

_tensor_nbytes

_value_nbytes

Estimate data bytes, optionally counting shared leaves only once.

_value_segment_count

Count media leaves, optionally counting shared objects only once.

_typed_content_media_nbytes

Count media embedded in typed vLLM content without counting prompt text.

_typed_content_media_segment_count

Count media leaves embedded in typed content without counting text.

protocol5_serialized_nbytes

Return cloudpickle protocol-5 frame plus out-of-band buffer bytes.

collect_multimodal_payload_metrics

Measure one exact Ray argument without scanning when disabled.

collect_sharded_multimodal_payload_metrics

Aggregate metrics over the exact unique per-DP-shard Ray arguments.

merge_multimodal_payload_metrics

Aggregate payload measurements collected during one logging interval.

drain_multimodal_payload_metrics

Return and clear payload measurements recorded in this process.

print_multimodal_payload_metrics

Record metrics for the logger and print a stable, scrapeable line.

Data#

API#

nemo_rl.utils.multimodal_payload_metrics._PENDING_PAYLOAD_METRICS: dict[str, int | float]#

None

nemo_rl.utils.multimodal_payload_metrics._PENDING_PAYLOAD_METRICS_LOCK#

‘Lock(…)’

nemo_rl.utils.multimodal_payload_metrics._tensor_nbytes(value: torch.Tensor | None) int#
nemo_rl.utils.multimodal_payload_metrics._value_nbytes(value: Any, seen: set[int] | None = None) int#

Estimate data bytes, optionally counting shared leaves only once.

nemo_rl.utils.multimodal_payload_metrics._value_segment_count(
value: Any,
seen: set[int] | None = None,
) int#

Count media leaves, optionally counting shared objects only once.

nemo_rl.utils.multimodal_payload_metrics._typed_content_media_nbytes(
value: Any,
seen: set[int] | None = None,
) int#

Count media embedded in typed vLLM content without counting prompt text.

nemo_rl.utils.multimodal_payload_metrics._typed_content_media_segment_count(
value: Any,
seen: set[int] | None = None,
) int#

Count media leaves embedded in typed content without counting text.

nemo_rl.utils.multimodal_payload_metrics.protocol5_serialized_nbytes(value: Any) int#

Return cloudpickle protocol-5 frame plus out-of-band buffer bytes.

nemo_rl.utils.multimodal_payload_metrics.collect_multimodal_payload_metrics(
data: Any,
boundary: str,
*,
enabled: bool,
) dict[str, int | float]#

Measure one exact Ray argument without scanning when disabled.

nemo_rl.utils.multimodal_payload_metrics.collect_sharded_multimodal_payload_metrics(
shards: collections.abc.Sequence[collections.abc.Mapping[str, Any]],
boundary: str,
*,
enabled: bool,
) dict[str, int | float]#

Aggregate metrics over the exact unique per-DP-shard Ray arguments.

nemo_rl.utils.multimodal_payload_metrics.merge_multimodal_payload_metrics(
metric_sets: collections.abc.Sequence[collections.abc.Mapping[str, int | float]],
) dict[str, int | float]#

Aggregate payload measurements collected during one logging interval.

Byte and segment counts are summed because repeated calls represent distinct Ray transfers. Per-call maxima and shard counts retain their maximum value, and physical-to-logical ratios are recomputed from the aggregated byte totals instead of averaging ratios.

nemo_rl.utils.multimodal_payload_metrics.drain_multimodal_payload_metrics() dict[str, int | float]#

Return and clear payload measurements recorded in this process.

nemo_rl.utils.multimodal_payload_metrics.print_multimodal_payload_metrics(
metrics: collections.abc.Mapping[str, int | float],
) None#

Record metrics for the logger and print a stable, scrapeable line.