bridge.data.builders.energon#
Serializable configuration and runtime builder for Energon VLM data.
Module Contents#
Classes#
Serializable settings for the generic Hugging Face Energon task encoder. |
|
Serializable settings for the Qwen-VL Energon task encoder. |
|
Serializable settings for the Nemotron Omni Energon task encoder. |
|
Serializable configuration for an Energon-backed multimodal dataset. |
|
Build Energon runtime dataloader iterators from declarative config. |
Functions#
Construct the configured Energon task encoder at runtime. |
|
Build Energon iterators through the canonical runtime builder. |
Data#
API#
- bridge.data.builders.energon._validate_hf_path(path: str, *, field_name: str) None#
- class bridge.data.builders.energon.HFEnergonTaskEncoderConfig#
Serializable settings for the generic Hugging Face Energon task encoder.
visual_keysnames processor output tensors retained in the model batch.min_pixelsandmax_pixelsare independent processor preprocessing bounds controlling visual resolution and token cost; they are not output keys.- hf_processor_path: str#
None
- visual_keys: tuple[str, ...]#
(‘pixel_values’,)
- min_pixels: int | None#
None
- max_pixels: int | None#
None
- trust_remote_code: bool | None#
None
- validate() None#
Validate generic Hugging Face task-encoder settings.
- class bridge.data.builders.energon.QwenVLEnergonTaskEncoderConfig#
Serializable settings for the Qwen-VL Energon task encoder.
Qwen’s visual output keys are model-owned.
min_pixelsandmax_pixelsinstead bound processor preprocessing and visual-token cost.- hf_processor_path: str#
None
- temporal_patch_size: int#
2
- spatial_merge_size: int#
2
- patch_size: int#
14
- min_pixels: int#
200704
- max_pixels: int#
1003520
- max_num_images: int | None#
10
- max_num_frames: int | None#
60
- max_visual_tokens: int | None#
16384
- trust_remote_code: bool | None#
None
- validate() None#
Validate Qwen-VL task-encoder settings.
- class bridge.data.builders.energon.NemotronOmniEnergonTaskEncoderConfig#
Serializable settings for the Nemotron Omni Energon task encoder.
visual_keysis retained for configuration compatibility, but Omni owns its visual input contract and supports only("pixel_values",).- hf_processor_path: str#
None
- max_audio_duration: float#
None
- num_mel_bins: int#
None
- visual_keys: tuple[str, ...]#
None
- temporal_patch_size: int#
None
- video_fps: float#
None
- video_nframes: int#
None
- use_temporal_video_embedder: bool#
None
- patch_dim: int#
None
- trust_remote_code: bool | None#
None
- validate() None#
Validate Nemotron Omni task-encoder settings.
- bridge.data.builders.energon.EnergonTaskEncoderConfig#
None
- class bridge.data.builders.energon.EnergonDatasetConfig#
Bases:
megatron.bridge.data.base.DataloaderConfigSerializable configuration for an Energon-backed multimodal dataset.
- path: str | None#
None
- seq_length: int#
None
- micro_batch_size: int#
None
- task_encoder: bridge.data.builders.energon.EnergonTaskEncoderConfig#
None
- dataloader_type: Literal[external] | None#
‘external’
- do_validation: bool#
True
- do_test: bool#
False
- num_val_workers: int | None#
None
- shuffle_buffer_size: int#
100
- max_samples_per_sequence: int | None#
None
- packing_buffer_size: int | None#
None
- dataset_kwargs: dict[str, Any]#
‘field(…)’
- enable_in_batch_packing: bool#
False
- defer_in_batch_packing_to_step: bool#
False
- pad_to_max_length: bool#
False
- pad_to_multiple_of: int#
128
- in_batch_packing_pad_to_multiple_of: int#
1
- validate() None#
Validate declarative Energon settings.
- finalize() None#
Finalize dataloader fields and validate the config.
- bridge.data.builders.energon.build_energon_task_encoder( ) Any#
Construct the configured Energon task encoder at runtime.
- class bridge.data.builders.energon.EnergonDatasetBuilder( )#
Build Energon runtime dataloader iterators from declarative config.
Initialization
- build(
- context: megatron.bridge.data.base.DatasetBuildContext,
Build requested Energon train and validation iterators.
- bridge.data.builders.energon.energon_train_valid_test_datasets_provider(
- train_val_test_num_samples: list[int],
- dataset_config: bridge.data.builders.energon.EnergonDatasetConfig,
- tokenizer: Any | None = None,
- pg_collection: Any | None = None,
Build Energon iterators through the canonical runtime builder.