bridge.data.builders.mock_vlm_sft#
Serializable config and runtime builder for synthetic VLM conversations.
Module Contents#
Classes#
Serializable settings for synthetic conversation-style VLM data. |
|
Build synthetic VLM datasets from declarative settings. |
Functions#
Create one synthetic conversation with the configured number of images. |
|
Generate the deterministic base examples reused by every requested split. |
|
Build one requested synthetic VLM split. |
|
Build synthetic VLM splits through the canonical runtime builder. |
Data#
API#
- bridge.data.builders.mock_vlm_sft._MOCK_RESPONSE_VOCABULARY#
‘split(…)’
- class bridge.data.builders.mock_vlm_sft.MockVLMSFTDatasetConfig#
Bases:
megatron.bridge.data.base.DataloaderConfigSerializable settings for synthetic conversation-style VLM data.
- seq_length: int#
None
- hf_processor_path: str#
None
- prompt: str#
‘Describe this image.’
- random_seed: int#
0
- image_size: tuple[int, int]#
(256, 256)
- num_images: int#
1
- num_base_examples: int#
1000
- skip_getting_attention_mask_from_dataset: bool#
True
- dataloader_type: Literal[single, cyclic] | None#
‘single’
- 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 synthetic data settings.
- finalize() None#
Finalize dataloader settings and validate this config.
- bridge.data.builders.mock_vlm_sft.make_mock_vlm_example(
- config: bridge.data.builders.mock_vlm_sft.MockVLMSFTDatasetConfig,
- rng: numpy.random.Generator,
- response_text: str,
Create one synthetic conversation with the configured number of images.
- bridge.data.builders.mock_vlm_sft.make_mock_vlm_examples( ) list[dict[str, Any]]#
Generate the deterministic base examples reused by every requested split.
- bridge.data.builders.mock_vlm_sft.build_mock_vlm_sft_split(
- config: bridge.data.builders.mock_vlm_sft.MockVLMSFTDatasetConfig,
- base_examples: list[dict[str, Any]],
- target_length: int,
- processor: Any,
Build one requested synthetic VLM split.
- class bridge.data.builders.mock_vlm_sft.MockVLMSFTDatasetBuilder( )#
Build synthetic VLM datasets from declarative settings.
Initialization
- build(
- context: megatron.bridge.data.base.DatasetBuildContext,
Build the train, validation, and test splits requested by the schedule.
- bridge.data.builders.mock_vlm_sft.mock_vlm_sft_train_valid_test_datasets_provider(
- train_val_test_num_samples: list[int],
- dataset_config: bridge.data.builders.mock_vlm_sft.MockVLMSFTDatasetConfig,
- tokenizer: Any | None = None,
- pg_collection: Any | None = None,
Build synthetic VLM splits through the canonical runtime builder.