MCPcopy Create free account

hub / github.com/JinjieNi/MegaDLMs / functions

Functions4,219 in github.com/JinjieNi/MegaDLMs

↓ 2 callersFunction_add_load_convert_hooks
Register some load_state_dict prehooks to handle some known state_dict key mismatch. (legacy <-> modelopt) and (default te <-> modelopt)
megatron/inference/gpt/model_provider.py:27
↓ 2 callersMethod_add_scales_to_converter
Adds scaling factors to the distributed and single device converters. Args: converter (ModelWeightConverter): Converter, holding
megatron/core/export/trtllm/trtllm_helper.py:325
↓ 2 callersFunction_add_tokenizer_args
(parser)
megatron/training/arguments.py:1830
↓ 2 callersMethod_allocate_memory
(self, inference_max_sequence_len, batch_size, num_attention_heads)
megatron/legacy/model/transformer.py:644
↓ 2 callersFunction_allreduce_conditional_embedding_grads
All-reduce conditional embedding grads. Reduce grads across all the pp stages to ensure that parameters of the conditional embedders (e.
megatron/core/distributed/finalize_model_grads.py:69
↓ 2 callersFunction_allreduce_loss
Reduce loss for reporting purposes.
megatron/inference/gpt/loss_func.py:42
↓ 2 callersMethod_build_megatron_datasets_parallel
Build the megatron datasets for a list of prefixes in parallel Args: prefixes (List[str]): The list of prefix strings
megatron/core/datasets/blended_megatron_dataset_builder.py:306
↓ 2 callersMethod_build_meta
Build docstring element. :param text: docstring element text :param title: title of section containing element :return:
tools/retro/config_utils.py:291
↓ 2 callersFunction_build_ordered_index
Build the range [0, size) and shuffle Args: num_samples (int): The size of the first shuffle range [0, num_samples) total_size (
megatron/core/datasets/gpt_dataset.py:1369
↓ 2 callersMethod_build_sample_index
( self, sequence_length: int, min_sentences_per_sample: int )
megatron/core/datasets/masked_dataset.py:145
↓ 2 callersFunction_build_shuffle_index
Build the range [0, size) and shuffle Args: num_samples (int): The size of the first shuffle range [0, num_samples) total_size (
megatron/core/datasets/gpt_dataset.py:603
↓ 2 callersFunction_build_tokenizer
Initialize tokenizer.
megatron/training/global_vars.py:138
↓ 2 callersFunction_configure_global_num_microbatches_calculator
Configure number of microbatches calculator. Can be used for initialization and reconfiguration. Args: rank (int): Rank o
megatron/core/num_microbatches_calculator.py:144
↓ 2 callersFunction_covert_to_moe_state_dict
Convert a dense model's state_dict to a MoE model's state_dict. This function takes the state dictionary of a dense model and modifies it to
megatron/core/transformer/moe/upcycling_utils.py:13
↓ 2 callersMethod_create_masked_lm_predictions
Creates the predictions for the masked LM objective Args: token_ids (List[int]): The token ids target_sequence_length
megatron/core/datasets/masked_dataset.py:230
↓ 2 callersMethod_decode_extra_state
(self, state)
megatron/core/extensions/transformer_engine.py:924
↓ 2 callersMethod_encode_extra_state
(self, state)
megatron/core/extensions/transformer_engine.py:919
↓ 2 callersFunction_evaluate_and_print_results
Helper function to evaluate and dump results on screen.
megatron/training/training.py:1978
↓ 2 callersMethod_extract_common_per_param_step
(state_dict)
megatron/core/optimizer/optimizer.py:301
↓ 2 callersMethod_extract_from_cache
Extract `size` bytes starting at `offset` bytes into the cache
megatron/core/datasets/indexed_dataset.py:445
↓ 2 callersMethod_forward_step_helper
Single forward step. Update the allocate memory flag so only the first time the memory is allocated.
megatron/inference/text_generation/forward_step.py:70
↓ 2 callersMethod_get
(cls, schema, model)
tools/checkpoint/schema_base.py:62
↓ 2 callersFunction_get_difflm_mlp_module_spec
Helper function to get module spec for MLP/MoE
megatron/core/models/difflm/gpt_layer_specs.py:449
↓ 2 callersMethod_get_elapsed_time_all_ranks
Returns elapsed times of timers in names. Assumptions: - All the ranks call this function. - `names` are identical on
megatron/core/timers.py:215
↓ 2 callersFunction_get_empty_tensor_for_exchange
Determines the empty tensor to use for exchange. If shard_id is needed by this rank, it will be in the `unloaded_shards`. Otherwise, the meta
megatron/core/dist_checkpointing/exchange_utils.py:73
↓ 2 callersFunction_get_field
(string, type)
megatron/training/training_nan_skipping.py:198
↓ 2 callersFunction_get_field
(string, type)
megatron/training/training.py:194
↓ 2 callersFunction_get_megatron_optimizer_based_on_param_groups
Get Megatron optimizer based on parameter groups. Args: config (OptimizerConfig): optimizer configuration object. model_chunks (l
megatron/core/optimizer/__init__.py:235
↓ 2 callersFunction_get_mlp_module_spec
(use_te: bool = True)
megatron/core/models/vision/vit_layer_specs.py:87
↓ 2 callersFunction_get_mlp_module_spec
Helper function to get module spec for MLP/MoE
megatron/core/models/difflm/gpt_layer_specs.py:417
↓ 2 callersMethod_get_model_and_main_params_data_float16
(self)
megatron/core/optimizer/optimizer.py:618
↓ 2 callersMethod_get_num_epochs
Calculate the number of epochs Args: num_tokens_per_epoch (int): The number of tokens in a single epoch Returns:
megatron/core/datasets/gpt_dataset.py:1346
↓ 2 callersMethod_get_num_tokens_per_epoch
Calculate the number of tokens in a single epoch Returns: int: The number of tokens in a single epoch
megatron/core/datasets/gpt_dataset.py:1338
↓ 2 callersFunction_get_param_groups_and_buffers
Returns parameter groups and buffer for optimizer. Args: model_chunks (List[MegatronModule]): model chunks to create parameter
megatron/core/optimizer/__init__.py:185
↓ 2 callersFunction_get_size_per_split_per_dataset
Determine the contribution of the MegatronDataset splits to the BlendedDataset splits Args: normalized_weights (List[float]): e.g. [0.3,
megatron/core/datasets/blended_megatron_dataset_builder.py:507
↓ 2 callersMethod_get_trtllm_config
Get TRTLLM Config Returns appropriate TRTLLM PretrainedConfig used by TRTLLM for building engine Args: export_config (Ex
megatron/core/export/trtllm/trtllm_helper.py:92
↓ 2 callersFunction_handle_tensor_list
This basically handles all the cases that we expect to see. Either the list None, or it's a singleton (the usual cases, since most ranks only
megatron/core/pipeline_parallel/p2p_communication.py:393
↓ 2 callersFunction_is_cuda
Check if a tensor is not none and is cuda.
megatron/inference/text_generation/communication.py:43
↓ 2 callersFunction_kernel_make_viewless_tensor
Make a viewless tensor. View tensors have the undesirable side-affect of retaining a reference to the originally-viewed tensor, even after ma
megatron/core/utils.py:183
↓ 2 callersFunction_load_checkpoint
(queue, args)
tools/checkpoint/loader_core.py:35
↓ 2 callersFunction_load_global_dist_base_checkpoint
Load the base state_dict from the given directory containing the global distributed checkpoint
megatron/training/checkpointing.py:865
↓ 2 callersFunction_mask_loss
Apply mask to the unreduced loss tensor.
megatron/inference/gpt/loss_func.py:15
↓ 2 callersMethod_new_bucket
Helper function that creates a new bucket. Also updates param->bucket mapping.
megatron/core/distributed/param_and_grad_buffer.py:681
↓ 2 callersFunction_normalize_answer
(s)
tasks/orqa/unsupervised/qa_utils.py:159
↓ 2 callersFunction_open_zarr_array_verbose
(path: Path, mode: str, **open_kwargs)
megatron/core/dist_checkpointing/strategies/zarr.py:214
↓ 2 callersFunction_pad_if_needed
(numel_unpadded, divisor)
tests/unit_tests/distributed/test_param_and_grad_buffer.py:85
↓ 2 callersMethod_pad_tensor_for_fp8
Padding tensor shape to multiples of 16.
megatron/core/transformer/moe/experts.py:765
↓ 2 callersMethod_preprocess_data
Preprocess input data before input to language model. This function is adopted from https://github.com/huggingface/transformers/blob/
megatron/core/models/multimodal/llava_model.py:279
↓ 2 callersFunction_pretrain
Main training program. This function will run the followings in the order provided: 1) initialize Megatron. 2) setup model, optim
megatron/training/training_nan_skipping.py:236
↓ 2 callersFunction_pretrain
Main training program. This function will run the followings in the order provided: 1) initialize Megatron. 2) setup model, optim
megatron/training/training.py:232
↓ 2 callersMethod_process_embedding_token_parallel
Processes the input data for model parallelism support. When using sequence parallelism (SP) or context parallelism (CP), the sequence is sha
megatron/core/models/multimodal/llava_model.py:505
↓ 2 callersFunction_process_memory
Get memory used by current process. Returns (int): memory used by current process
megatron/core/dist_checkpointing/strategies/filesystem_async.py:431
↓ 2 callersMethod_query_document_sample_shuffle_indices
Get the text (token ids) and document ids for a given index Args: idx (int): The index into the dataset Returns:
megatron/core/datasets/gpt_dataset.py:1046
↓ 2 callersFunction_replace_state_dict_keys_with_sharded_keys
Group ShardedBase objects by keys and return mappings required for recreating the original dict.
megatron/core/dist_checkpointing/strategies/torch.py:393
↓ 2 callersMethod_restore_common_per_param_step
(state_dict: Dict, step: Union[int, torch.Tensor])
megatron/core/optimizer/optimizer.py:316
↓ 2 callersMethod_restore_state
Internal method that restores the state that was saved in _save_state().
megatron/core/rerun_state_machine.py:776
↓ 2 callersFunction_round
Round `batch_size` down to nearest batch size divisible by `divisor`.
megatron/core/num_microbatches_calculator.py:261
↓ 2 callersMethod_run_full_checkpoint_test
(self, fp8)
tests/unit_tests/transformer/test_transformer_block.py:78
↓ 2 callersMethod_run_selective_checkpoint_test
(self, fp8)
tests/unit_tests/transformer/test_transformer_block.py:109
↓ 2 callersMethod_sanitize_data_iterators
( self, data_iterator: DataIteratorArgType )
megatron/core/rerun_state_machine.py:725
↓ 2 callersFunction_send_and_recv_from_last_to_first_pipeline_stage
(tensor=None)
megatron/inference/text_generation/communication.py:80
↓ 2 callersMethod_set
(cls, schema, model, params)
tools/checkpoint/schema_base.py:76
↓ 2 callersMethod_setup
(self)
tools/retro/config_utils.py:277
↓ 2 callersFunction_sharded_object_id
Unique id of the sharded object data. Should yield the same value for same data replicated on different ranks. Args: sharded_object
megatron/core/dist_checkpointing/utils.py:41
↓ 2 callersMethod_sharded_state_dict_grouped
prefix should be module_name to make keys identical to sequetial ones.
megatron/core/extensions/transformer_engine.py:960
↓ 2 callersFunction_should_create_array
(ten: ShardedTensor)
megatron/core/dist_checkpointing/strategies/zarr.py:122
↓ 2 callersFunction_split_tensor_factory
Builds a factory that splits a given ShardedTensor into several independent chunks.
megatron/core/ssm/mamba_mixer.py:661
↓ 2 callersMethod_test_helper
(self, loss_type, test_type)
tests/functional_tests/python_test_utils/test_resume_checkpoint_pipeline.py:29
↓ 2 callersMethod_test_helper
(self, metric_type: str, metric_dict: List[Union[int, float]], test_type)
tests/functional_tests/python_test_utils/test_ci_pipeline.py:29
↓ 2 callersFunction_ut_router_transformer_forward
( self, hidden_states: Tensor, attention_mask: Tensor, context: Tensor = None,
megatron/core/transformer/custom_layers/ut_modules.py:1348
↓ 2 callersFunction_yarn_find_correction_dim
( num_rotations: float, dim: int, rotary_base: float = 10000, max_position_embeddings: int = 2048 )
megatron/core/models/common/embeddings/yarn_rotary_pos_embedding.py:146
↓ 2 callersMethodadd
Add a new hypothesis to the list.
megatron/inference/text_generation/beam_utils.py:37
↓ 2 callersMethodadd_finalize_fn
Adds a new finalize function to the request. Args: fn (Callable): function to add to the async request. This function
megatron/core/dist_checkpointing/strategies/async_utils.py:34
↓ 2 callersMethodadd_index
Add an entire IndexedDataset to the dataset Args: path_prefix (str): The index (.idx) and data (.bin) prefix
megatron/core/datasets/indexed_dataset.py:804
↓ 2 callersFunctionadd_to_index
Entry point for adding to the index. We select whether to add to a new index, or validate an existing index. Args: config (RetroPrep
megatron/core/datasets/retro/index/build.py:273
↓ 2 callersFunctionaggregate_states
(history_states, history_logits, softmax=False)
megatron/core/transformer/custom_layers/ut_modules.py:1312
↓ 2 callersFunctionall_reduce_autograd
( tensor, op=torch.distributed.ReduceOp.SUM, group=torch.distributed.group.WORLD )
megatron/inference/algos/distillation.py:426
↓ 2 callersMethodapply_chat_template
Convert a conversation to token IDs.
tests/unit_tests/test_tokenizer.py:214
↓ 2 callersMethodapply_load_balancing_loss
Calculate auxiliary loss, attach gradient function to activation and add to logging.
megatron/core/transformer/moe/router.py:214
↓ 2 callersFunctionapply_nd_flattened_tensors_reformulation
Applies N-D reformulation to a given sharded state dict. After applying the method and loading the reformulated state dict, the `restore_nd_f
megatron/core/dist_checkpointing/strategies/resharding.py:99
↓ 2 callersMethodapply_saving_parallelization
Distributes the save across ranks by exchanging metadata. Exchanges metadata from the state dict and computes the uniform (as close a
megatron/core/dist_checkpointing/strategies/fully_parallel.py:88
↓ 2 callersFunctionapply_threshold
(preds, t)
tasks/ensemble_classifier.py:60
↓ 2 callersMethodasync_save
Perform preparation and return an AsyncRequest to the external caller. Args: sharded_state_dict (ShardedStateDict): sharded state
megatron/core/dist_checkpointing/strategies/base.py:205
↓ 2 callersMethodbackward
(ctx, output_grads)
megatron/core/fusions/fused_softmax.py:88
↓ 2 callersFunctionbaseline_get_model_chunk_id
Helper method to get the model chunk ID given the iteration number.
tests/unit_tests/pipeline_parallel/test_helpers.py:5
↓ 2 callersFunctionbias_gelu
(bias, y)
megatron/legacy/model/fused_bias_gelu.py:16
↓ 2 callersFunctionbias_swiglu
(y, bias)
megatron/core/fusions/fused_bias_swiglu.py:18
↓ 2 callersFunctionbiencoder_model_provider
Build the model.
megatron/legacy/model/biencoder_model.py:37
↓ 2 callersFunctionbroadcast_from_last_pipeline_stage
Broadcast a tensor from last pipeline stage to all ranks.
megatron/core/inference/communication_utils.py:13
↓ 2 callersFunctionbroadcast_list
Broadcast a list of values with a given type. Args: data_parallel (bool): Broadcast across a single data parallel model replica.
megatron/inference/text_generation/communication.py:186
↓ 2 callersMethodbroadcast_params
Syncs parameters across all DP ranks.
megatron/core/distributed/data_parallel_base.py:67
↓ 2 callersFunctionbuild_dataset
Helper function to select and build dataset.
tasks/zeroshot_gpt/datasets.py:17
↓ 2 callersFunctionbuild_datasets
(idir, odir, extra_args=[])
tests/unit_tests/data/test_preprocess_data.py:54
↓ 2 callersFunctionbuild_gpt_chunk_datasets_from_gpt_datasets
Get train, valid, test GPT chunk datasets. Args: project_dir (str): Retro project dir. gpt_datasets (dict): Mapping of 'train', '
megatron/core/datasets/retro/query/gpt_chunk_dataset.py:79
↓ 2 callersFunctionbuild_sample
Convert to numpy and return a sample consumed by the batch producer.
tasks/data_utils.py:20
↓ 2 callersFunctionbuild_token_types_from_context_list
(ctx_list, tokenizer, max_seq_length)
tasks/orqa/supervised/data.py:16
↓ 2 callersFunctionbuild_tokens_types_paddings_from_ids
Build token types and paddings, trim if needed, and pad if needed.
tasks/data_utils.py:49
↓ 2 callersFunctionbuild_train_valid_test_data_iterators
Build pretraining data iterators.
megatron/training/training_nan_skipping.py:2024
↓ 2 callersFunctionbuild_train_valid_test_datasets
Build pretraining datasets.
megatron/training/training.py:2081
↓ 2 callersMethodcalculate_cross_entropy_loss
Calculates cross entropy loss.
megatron/core/tensor_parallel/cross_entropy.py:71
← previousnext →601–700 of 4,219, ranked by callers