bridge.recipes.gemma.gemma3#
Module Contents#
Classes#
Typed options accepted by Gemma3 family recipe helpers. |
Functions#
Return a pre-training config for Gemma3 1B. |
|
Create a pre-training configuration for Gemma3 family models. |
Data#
API#
- class bridge.recipes.gemma.gemma3.Gemma3CommonKwargs#
Bases:
typing_extensions.TypedDictTyped options accepted by Gemma3 family recipe helpers.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- provider_class: type#
None
- hf_path: str | None#
None
- dir: str | None#
None
- name: str#
None
- data_paths: list[str] | None#
None
- data_args_path: str | None#
None
- train_data_path: list[str] | None#
None
- valid_data_path: list[str] | None#
None
- test_data_path: list[str] | None#
None
- per_split_data_args_path: str | None#
None
- mock: bool#
None
- tensor_parallelism: int#
None
- pipeline_parallelism: int#
None
- pipeline_parallelism_dtype: torch.dtype | None#
None
- virtual_pipeline_parallelism: int | None#
None
- context_parallelism: int#
None
- sequence_parallelism: bool#
None
- use_megatron_fsdp: bool#
None
- account_for_embedding_in_pipeline_split: bool#
None
- account_for_loss_in_pipeline_split: bool#
None
- train_iters: int#
None
- global_batch_size: int#
None
- micro_batch_size: int#
None
- seq_length: int#
None
- lr: float#
None
- min_lr: float#
None
- lr_warmup_iters: int#
None
- lr_decay_iters: int | None#
None
- eval_interval: int#
None
- save_interval: int#
None
- use_null_tokenizer: bool#
None
- precision_config: megatron.bridge.training.mixed_precision.MixedPrecisionConfig | str | None#
None
- comm_overlap_config: megatron.bridge.training.comm_overlap.CommOverlapConfig | None#
None
- bridge.recipes.gemma.gemma3.SEQUENCE_LENGTH_32K: int#
32768
- bridge.recipes.gemma.gemma3.SEQUENCE_LENGTH_128K: int#
131072
- bridge.recipes.gemma.gemma3.gemma3_1b_pretrain_config(
- **user_kwargs: typing_extensions.Unpack[bridge.recipes.gemma.gemma3.Gemma3CommonKwargs],
Return a pre-training config for Gemma3 1B.
See
_gemma3_commonfor the full list of parameters.
- bridge.recipes.gemma.gemma3._gemma3_common(
- provider_class: type,
- hf_path: str | None = None,
- dir: str | None = None,
- name: str = 'default',
- data_paths: list[str] | None = None,
- data_args_path: str | None = None,
- train_data_path: list[str] | None = None,
- valid_data_path: list[str] | None = None,
- test_data_path: list[str] | None = None,
- per_split_data_args_path: str | None = None,
- mock: bool = False,
- tensor_parallelism: int = 1,
- pipeline_parallelism: int = 1,
- pipeline_parallelism_dtype: torch.dtype | None = None,
- virtual_pipeline_parallelism: int | None = None,
- context_parallelism: int = 1,
- sequence_parallelism: bool = False,
- use_megatron_fsdp: bool = False,
- account_for_embedding_in_pipeline_split: bool = False,
- account_for_loss_in_pipeline_split: bool = False,
- train_iters: int = 1168251,
- global_batch_size: int = 512,
- micro_batch_size: int = 1,
- seq_length: int = 131072,
- lr: float = 0.0003,
- min_lr: float = 3e-05,
- lr_warmup_iters: int = 2000,
- lr_decay_iters: int | None = None,
- eval_interval: int = 2000,
- save_interval: int = 500,
- use_null_tokenizer: bool = True,
- precision_config: megatron.bridge.training.mixed_precision.MixedPrecisionConfig | str | None = 'bf16_mixed',
- comm_overlap_config: megatron.bridge.training.comm_overlap.CommOverlapConfig | None = None,
Create a pre-training configuration for Gemma3 family models.
- Parameters:
provider_class (type) β Gemma3 model provider class (e.g., Gemma3ModelProvider1B).
hf_path (str | None) β HuggingFace model path (e.g., βgoogle/gemma-3-1bβ).
dir (str | None) β Base directory for saving logs and checkpoints.
name (str) β Name of the pre-training run.
data_paths (list[str] | None) β List of paths to dataset files. If None, mock data will be used.
data_args_path (str | None) β Path to file containing data arguments.
train_data_path (list[str] | None) β List of training data paths.
valid_data_path (list[str] | None) β List of validation data paths.
test_data_path (list[str] | None) β List of test data paths.
per_split_data_args_path (str | None) β Path to JSON file with per-split data configuration.
mock (bool) β Whether to use mock data. If True, ignores data_paths.
tensor_parallelism (int) β Degree of tensor model parallelism.
pipeline_parallelism (int) β Degree of pipeline model parallelism.
pipeline_parallelism_dtype (torch.dtype | None) β Data type for pipeline parallelism.
virtual_pipeline_parallelism (int | None) β Size of virtual pipeline parallelism.
context_parallelism (int) β Degree of context parallelism.
sequence_parallelism (bool) β Whether to use sequence parallelism.
use_megatron_fsdp (bool) β Whether to use Megatron FSDP.
account_for_embedding_in_pipeline_split (bool) β Whether to account for embedding in pipeline split.
account_for_loss_in_pipeline_split (bool) β Whether to account for loss in pipeline split.
train_iters (int) β Total number of training iterations.
global_batch_size (int) β Global batch size for training.
micro_batch_size (int) β Micro batch size for training.
seq_length (int) β Sequence length for training data.
lr (float) β Learning rate.
min_lr (float) β Minimum learning rate for cosine decay.
lr_warmup_iters (int) β Number of warmup iterations for the learning rate.
lr_decay_iters (int | None) β Number of iterations over which to decay the LR.
eval_interval (int) β Evaluation interval.
save_interval (int) β Checkpoint save interval.
use_null_tokenizer (bool) β Whether to use null tokenizer for synthetic data.
precision_config (MixedPrecisionConfig | str | None) β Precision configuration for the model.
comm_overlap_config (CommOverlapConfig | None) β Communication overlap configuration.
- Returns:
Configuration for pre-training.
- Return type: