MCPcopy Create free account

hub / github.com/JinjieNi/MegaDLMs / functions

Functions4,219 in github.com/JinjieNi/MegaDLMs

↓ 7 callersFunctionget_idx_path
Get the path to the index file from the prefix Args: path_prefix (str): The prefix Returns: str: The path to the index file
megatron/core/datasets/indexed_dataset.py:836
↓ 7 callersFunctionget_language_model
Build language model and return along with the key to save.
megatron/legacy/model/language_model.py:49
↓ 7 callersFunctioninit_basic_mock_args
(args, tp, pp, bf16=True)
tests/unit_tests/dist_checkpointing/utils.py:101
↓ 7 callersMethodinitialize_distributed
()
tests/unit_tests/test_utilities.py:36
↓ 7 callersMethodlocal_chunk_offset_in_global
Offset of a local chunk in a global array of chunks. Returns: Tuple[int, ...]: the offset of the whole local chunk in a global ar
megatron/core/dist_checkpointing/mapping.py:205
↓ 7 callersFunctionmerge
Merges dicts and lists recursively.
megatron/core/dist_checkpointing/dict_utils.py:212
↓ 7 callersFunctionqueue_put
(name, msg)
tools/checkpoint/loader_legacy.py:240
↓ 7 callersFunctionreplace_prefix_for_sharding
Replaces the given prefix in *all* sharded keys in a given state dict. Errors out if some key does not begin with a given prefix. Args:
megatron/core/dist_checkpointing/utils.py:170
↓ 7 callersFunctionretro_makedir
Make a directory, conditional on not being in validation mode. Args: config (RetroPreprocessingConfig): Retro preprocessing config.
megatron/core/datasets/retro/utils.py:38
↓ 7 callersFunctionsave_checkpoint_and_time
(iteration, model, optimizer, opt_param_scheduler, num_floating_point_operations_
megatron/training/training_nan_skipping.py:1269
↓ 7 callersMethodsymbolic
Symbolic function for tracing.
megatron/core/tensor_parallel/mappings.py:205
↓ 7 callersMethodvalidate_metadata_integrity
Codifies the constraints on metadata attributes.
megatron/core/dist_checkpointing/mapping.py:40
↓ 7 callersFunctionvalidate_sharding_integrity
Validate if the ShardedTensors and ShardedObjects from multiple processes define correct sharding. Local ShardedTensors and ShardedObject metadat
megatron/core/dist_checkpointing/validation.py:394
↓ 7 callersMethodzero_grad
Copied from torch.optim.optimizer
megatron/core/optimizer/optimizer.py:772
↓ 6 callersMethod__init__
(self, config)
tools/weights_conversion/hf_configs/gptneox_1.7b_dlm/modeling_dlm.py:70
↓ 6 callersMethod__init__
(self, config)
tools/weights_conversion/hf_configs/gptneox_1.7b_ar/modeling_ar.py:64
↓ 6 callersMethod__init__
(self, config)
tools/weights_conversion/hf_configs/gpt2_1b_dlm/modeling_dlm.py:70
↓ 6 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.)
megatron/legacy/model/vision/esvit_swin_backbone.py:26
↓ 6 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.)
megatron/legacy/model/vision/swin_backbone.py:20
↓ 6 callersMethod__init__
( self, config: TransformerConfig, submodules: Union[SelfAttentionSubmodules, CrossAtt
megatron/core/transformer/attention.py:77
↓ 6 callersMethod_add_to_trtllm_model_weights
(self, val: torch.Tensor, layer_name: str)
megatron/core/export/trtllm/trtllm_weights_converter/distributed_trtllm_model_weights_converter.py:75
↓ 6 callersFunction_gather_along_last_dim
Gather tensors and concatinate along the last dimension.
megatron/core/tensor_parallel/mappings.py:79
↓ 6 callersFunction_get_extra_te_kwargs
(config: TransformerConfig)
megatron/core/extensions/transformer_engine.py:45
↓ 6 callersFunction_get_mlp_module_spec
Helper function to get module spec for MLP/MoE
megatron/core/models/gpt/gpt_layer_specs.py:233
↓ 6 callersFunction_get_weights
args: y_true : 3-d ndarray in [batch_size, img_rows, img_cols] nb_ch : int return [float] weights
tasks/vision/segmentation/metrics.py:78
↓ 6 callersFunction_multi_tensor_copy_this_to_that
Use multi-tensor-applier to copy values from one list to another. We don't have a bfloat16 implementation so for now if the overflow_buf
megatron/core/optimizer/optimizer.py:77
↓ 6 callersMethod_sanity_check_attention_and_get_attn_mask_dimension
We do some checks and return attention mask dimensions for self attention Transformer engine library underwent a lot of change. So we need to
megatron/core/models/bert/bert_model.py:158
↓ 6 callersFunctionappend_to_progress_log
Append given string to progress log.
megatron/training/utils.py:320
↓ 6 callersFunctionbroadcast_tensor
Given size and type of a tensor on all ranks and the tensor value only on a specific rank, broadcast from that rank to all other ranks. Args:
megatron/inference/text_generation/communication.py:159
↓ 6 callersMethodconfig_attention_mask
Config attention-mask for encoder_mask, decoder_mask, encoder_decoder_mask conditioned on transformer-implementation (e.g. TE vs local), TE ve
megatron/core/datasets/t5_dataset.py:128
↓ 6 callersFunctioncovert_to_experts
(keys)
megatron/core/transformer/moe/upcycling_utils.py:115
↓ 6 callersMethodcrop
Crop from ``img``
tasks/vision/segmentation/transforms.py:170
↓ 6 callersMethodelapsed
Calculates the elapsed time and restarts timer. Args: reset (bool, optional): Resets timer before restarting. Defaults to True.
megatron/core/timers.py:133
↓ 6 callersFunctionenable_grad_sync
Enable asynchronous grad reductions
megatron/core/pipeline_parallel/schedules.py:626
↓ 6 callersMethodfinalize
Clean up and write the index (.idx) file Args: idx_path (str): The path to the index file
megatron/core/datasets/indexed_dataset.py:825
↓ 6 callersFunctionfinetune
Main finetune function used across all tasks.
tasks/vision/finetune_utils.py:193
↓ 6 callersMethodget_added_index_path
Get file path to index that has been populated with vectors. Args: config (RetroPreprocessingConfig): Retro preprocessing config.
megatron/core/datasets/retro/index/index.py:76
↓ 6 callersFunctionget_data_parallel_group
Get the data-parallel group the caller rank belongs to.
megatron/core/parallel_state.py:1053
↓ 6 callersFunctionget_expert_tensor_parallel_rank
Return my rank for the expert tensor parallel group.
megatron/core/parallel_state.py:1650
↓ 6 callersFunctionget_expert_tensor_parallel_world_size
Return world size for the expert tensor parallel group.
megatron/core/parallel_state.py:1632
↓ 6 callersMethodget_parameter_state_dp_zero
Get parameter state (i.e., parameter & optimizer tensors). This method performs two steps: - For each DP rank, copy param & optimizer
megatron/core/optimizer/distrib_optimizer.py:822
↓ 6 callersMethodget_rotary_seq_len
Function to get the rotary sequence length. Args: inference_params : Used during Inference time transformer (Transfor
megatron/core/models/common/embeddings/rotary_pos_embedding.py:176
↓ 6 callersFunctionget_torch_version
Get pytorch version from __version__; if not available use pip's. Use caching.
megatron/core/utils.py:46
↓ 6 callersMethodload_state_dict
Load the state dicts of each of the models
megatron/legacy/model/biencoder_model.py:163
↓ 6 callersMethodnormalize
Shift start/end indexes to start at new start index. Both start and end indexes will be shifted by [new start] - [old start]. Args:
megatron/core/optimizer/distrib_optimizer.py:72
↓ 6 callersFunctionrecv_tensor_from_previous_stage
Determine if peers are sending, and where in data structure to put received tensors. Return a boolean if the pipeline stage expects to
megatron/core/pipeline_parallel/schedules.py:809
↓ 6 callersFunctionreduce_max_stat_across_model_parallel_group
Ranks without an optimizer will have no grad_norm or num_zeros_in_grad stats. We need to ensure the logging and writer rank has those values.
megatron/training/utils.py:150
↓ 6 callersFunctionregister_default_strategy
Adds a given strategy to the registry of default strategies. Args: action (StrategyAction): specifies save/load and sharded/common
megatron/core/dist_checkpointing/strategies/base.py:58
↓ 6 callersMethodset_states
Set the rng states. For efficiency purposes, we do not check the size of seed for compatibility.
megatron/core/tensor_parallel/random.py:118
↓ 6 callersFunctionsharded_state_dict_default
Provides implementation for sharded_state_dict method for non-MegatronModules. Tries to call `module.sharded_state_dict` when possible, other
megatron/core/transformer/utils.py:156
↓ 6 callersMethodtoken_permutation
Dispatch tokens to experts. Args: tokens (torch.Tensor): Input tokens. probs (torch.Tensor): The routing probability
megatron/core/transformer/moe/token_dispatcher.py:75
↓ 6 callersMethodtoken_unpermutation
Restores the expert output to its original ordering. Args: expert_output (torch.Tensor): The output tensor from the expert models
megatron/core/transformer/moe/token_dispatcher.py:91
↓ 6 callersFunctionverify_checkpoint_and_load_strategy
Verifies if checkpoint metadata exists and matches given strategies. If no strategies are passed, they are determined based on the checkpoint met
megatron/core/dist_checkpointing/validation.py:204
↓ 5 callersMethod__init__
Initialize self.
tools/retro/config_utils.py:163
↓ 5 callersFunction_initialize_affine_weight_gpu
Initialize affine weight for model parallel on GPU.
megatron/core/tensor_parallel/layers.py:111
↓ 5 callersFunction_set_cuda_rng_state
Sets the random number generator state of the current GPU. Argumentss: new_state (torch.ByteTensor): The desired state This function
megatron/core/tensor_parallel/random.py:31
↓ 5 callersFunction_vocab_size_with_padding
Pad vocab size so it is divisible by model parallel size and still having GPU friendly size.
megatron/training/tokenizer/tokenizer.py:106
↓ 5 callersFunction_zero_grad_group_helper
Zero out the gradient for a group of parameters. Note: copied from torch.optim.optimizer.
megatron/core/optimizer/optimizer.py:56
↓ 5 callersFunctionallocate_layers
( total_layers_count: int, target_attention_ratio: float, target_mlp_ratio: float, override_pa
megatron/core/ssm/mamba_hybrid_layer_allocation.py:84
↓ 5 callersFunctionbackward_step
Backward step through passed-in output tensor. If last stage, output_tensor_grad is None, otherwise gradient of loss with respect to stage's
megatron/core/pipeline_parallel/schedules.py:331
↓ 5 callersFunctionbert_position_ids
(token_ids)
megatron/legacy/model/bert_model.py:36
↓ 5 callersFunctionbias_dropout_add
(x, bias, residual, prob, training)
megatron/legacy/model/transformer.py:837
↓ 5 callersFunctionbroadcast_from_last_pipeline_stage
Broadcast a tensor from last pipeline stage to all ranks.
megatron/inference/text_generation/communication.py:57
↓ 5 callersFunctioncheck
(group, world_size, rank)
megatron/legacy/mpu/tests/test_initialize.py:23
↓ 5 callersFunctioncheck_first_val_step
Check if it is the first validation step.
megatron/core/pipeline_parallel/schedules.py:399
↓ 5 callersFunctionchunk_bias
(bias, parallel_mode, tp_size=1, ep_size=1)
tools/checkpoint/saver_core.py:364
↓ 5 callersMethodcompute_language_model_loss
Computes the language model loss (Cross entropy across vocabulary) Args: labels (Tensor): The labels of dimension [batch size, se
megatron/core/models/common/language_module/language_module.py:66
↓ 5 callersFunctioncompute_ngrams_insert_dict
(args, text, ngrams)
tools/openwebtext/filter_ngrams.py:181
↓ 5 callersMethoddecode
(self, tokens)
megatron/training/tokenizer/gpt2_tokenization.py:286
↓ 5 callersFunctiondisable_forward_pre_hook
(model_chunks, param_sync=True)
megatron/training/training_nan_skipping.py:1263
↓ 5 callersFunctiondisable_forward_pre_hook
(model_chunks, param_sync=True)
megatron/training/training.py:1274
↓ 5 callersMethodencode
(self, text)
megatron/training/tokenizer/gpt2_tokenization.py:283
↓ 5 callersMethodencoder
(self)
megatron/training/tokenizer/tokenizer.py:766
↓ 5 callersFunctionevaluate_and_print_results
(*args, **kwargs)
megatron/training/training.py:2032
↓ 5 callersMethodflops
(self)
megatron/legacy/model/vision/esvit_swin_backbone.py:458
↓ 5 callersMethodget_batch_for_context_window
Returns the inference data given context window This function gets called iteratively in a loop . Given the start and end context pos
megatron/core/inference/model_inference_wrappers/t5/t5_inference_wrapper.py:140
↓ 5 callersFunctionget_bin_path
Get the path to the data file from the prefix Args: path_prefix (str): The prefix Returns: str: The path to the data file
megatron/core/datasets/indexed_dataset.py:848
↓ 5 callersFunctionget_default_load_sharded_strategy
Get default load sharded strategy.
megatron/core/dist_checkpointing/serialization.py:422
↓ 5 callersFunctionget_expert_tensor_parallel_group
Get the expert-tensor-parallel group the caller rank belongs to.
megatron/core/parallel_state.py:1623
↓ 5 callersMethodget_index
Construct an index from an index type string. Args: index_type (str): One of 'faiss-base' (naive Faiss index wrapper) or 'faiss-p
megatron/core/datasets/retro/index/factory.py:29
↓ 5 callersFunctionget_indexed_dataset_
(data_prefix, dataset_type)
megatron/legacy/data/dataset_utils.py:594
↓ 5 callersFunctionget_local_model
(pp_rank, ep_rank, tp_rank)
tools/checkpoint/saver_core.py:326
↓ 5 callersMethodget_loss_scale
FP32 optimizer does not do any scaling.
megatron/core/optimizer/optimizer.py:779
↓ 5 callersMethodget_lr
Learning rate decay functions from: https://openreview.net/pdf?id=BJYwwY9ll pg. 4 Args: param_group (dict): parameter gro
megatron/core/optimizer_param_scheduler.py:121
↓ 5 callersFunctionget_ltor_masks_and_position_ids
Build masks and position id for left to right model.
megatron/training/utils.py:239
↓ 5 callersFunctionget_norm
(config)
megatron/legacy/model/utils.py:62
↓ 5 callersFunctionget_num_layers_to_build
Determine the number of transformer layers to build for the current pipeline stage. Args: config (TransformerConfig): Configuration o
megatron/core/transformer/transformer_block.py:60
↓ 5 callersMethodget_parameters
Get list of parameters wrapped in optimizer.
megatron/core/optimizer/optimizer.py:121
↓ 5 callersMethodgpt_to_text
GPT tokens to text.
tools/retro/cli/cli.py:80
↓ 5 callersFunctioninit_checkpointing_mock_args
(args, ckpt_dir, fully_parallel=False)
tests/unit_tests/dist_checkpointing/utils.py:123
↓ 5 callersMethodinit_data
Initialize the tensor data of this ShardedTensor. Only called if `data` attribute is None. Args: device (Union[
megatron/core/dist_checkpointing/mapping.py:338
↓ 5 callersFunctioninitialize_distributed
Initialize torch.distributed.
megatron/legacy/mpu/tests/commons.py:29
↓ 5 callersFunctionis_s3_path
Ascertain whether a path is in S3 Args: path (str): The path Returns: bool: True if the path is in S3, False otherwise
megatron/core/datasets/utils_s3.py:48
↓ 5 callersMethodload_state_dict
Load the state dicts of each of the models
megatron/legacy/model/realm_model.py:106
↓ 5 callersMethodload_state_dict
Customized load.
megatron/legacy/model/language_model.py:270
↓ 5 callersFunctionmake_attention_mask
Returns a 2-dimensional (2-D) attention mask :param source_block: 1-D array :param target_block: 1-D array
megatron/legacy/data/biencoder_dataset_utils.py:14
↓ 5 callersMethodmaybe_finalize_async_calls
Finalizes all available calls. This method must be called on all ranks. Args: blocking (bool, optional): if True, will w
megatron/core/dist_checkpointing/strategies/async_utils.py:189
↓ 5 callersFunctionmodel_provider
Builds the model. Args: pre_process (bool, optional): Set to true if you need to compute embedings. Defaults to True. post_proces
tools/retro/text_generation/retro_text_generation.py:28
↓ 5 callersFunctionpermute_qkv
(qkv_w: torch.Tensor, dim: int, n_heads: int, n_heads_kv: int, revert: bool = False, hidden_head: int = None)
tools/weights_conversion/utils/permute_qkv.py:12
↓ 5 callersMethodrecord
Record a new sample.
megatron/core/rerun_state_machine.py:898
← previousnext →201–300 of 4,219, ranked by callers