MCPcopy Create free account

hub / github.com/JinjieNi/MegaDLMs / functions

Functions4,219 in github.com/JinjieNi/MegaDLMs

↓ 13 callersFunctioninitialize_megatron
Set global variables, initialize distributed, and set autoresume and random seeds. `allow_no_cuda` should not be set unless using megatron for
megatron/training/initialize.py:32
↓ 13 callersFunctionprint_separator
(message)
megatron/legacy/mpu/tests/commons.py:63
↓ 13 callersMethodtrain
Train index on a representative set of vectors. Args: config (RetroPreprocessingConfig): Retro preprocessing config.
megatron/core/datasets/retro/index/index.py:103
↓ 12 callersFunction_argmax
args: y_data : 4-d tensor in [batch_size, chs, img_rows, img_cols] dim : int return 3-d [int] y_data
tasks/vision/segmentation/metrics.py:28
↓ 12 callersMethodclose
(self)
megatron/core/datasets/utils_s3.py:45
↓ 12 callersMethodfrom_rank_offsets_flat
Allows to construct a *flattened* ShardedTensor given offset specified in process ranks. Args: key (str): data (torch
megatron/core/dist_checkpointing/mapping.py:294
↓ 12 callersMethodwrite
Write the index (.idx) file Args: sequence_lengths (List[int]): The length of each sequence sequence_modes (Optional
megatron/core/datasets/indexed_dataset.py:161
↓ 11 callersFunction_set_random_seed
Set random seed for reproducability.
megatron/training/initialize.py:345
↓ 11 callersFunctioncompile_helpers
Compile C++ helper functions at runtime. Make sure this is invoked on a single process.
megatron/core/datasets/utils.py:21
↓ 11 callersMethoddetokenize
(self, ids)
megatron/training/tokenizer/tokenizer.py:783
↓ 11 callersFunctiongather_from_sequence_parallel_region
Wrapper for autograd function: forward: AG, backward: RS <first dim>
megatron/core/tensor_parallel/mappings.py:492
↓ 11 callersFunctionget_attr_wrapped_model
Get an attribute from a wrapped model. If return_model_obj is true, return the object that has the 'attr' attribute; otherwise, return the att
megatron/core/utils.py:113
↓ 11 callersFunctionget_pipeline_model_parallel_rank
Return caller's rank for the pipeline-model-parallel group.
megatron/core/parallel_state.py:1250
↓ 11 callersMethodget_tensor
Returns (potentially) a sub-tensor from the self.buffer for the given shape.
megatron/core/utils.py:167
↓ 11 callersFunctionmake_sharded_tensors_for_checkpoint
Wraps tensors from transformer layers with ShardedTensor or ShardedObject. For a given `state_dict`, wraps: - all _extra_states with ShardedO
megatron/core/transformer/utils.py:60
↓ 11 callersFunctionqueue_get
(name=None)
tools/checkpoint/saver_core.py:66
↓ 11 callersFunctionshorten_str
(s: str, n: int)
tools/retro/cli/cli.py:22
↓ 10 callersFunction_get_tp
args: y_true : [int] 3-d in [batch_size, img_rows, img_cols] y_pred : [int] 3-d in [batch_size, img_rows, img_cols] return [f
tasks/vision/segmentation/metrics.py:38
↓ 10 callersFunction_sharded_tensor_shard_id
Unique id of the sharded tensor data. Should yield the same value for same data replicated on different ranks. Args: sharded_tensor
megatron/core/dist_checkpointing/utils.py:23
↓ 10 callersFunctionapply_rotary_pos_emb
Reroute to the appropriate apply_rotary_pos_emb function depending on fused/unfused kernels, or bshd (conventional) / thd (packed seq) format
megatron/core/models/common/embeddings/rope_utils.py:178
↓ 10 callersFunctioncondition_init_method
Condition TE init_method on config.perform_initialization.
megatron/core/extensions/transformer_engine.py:56
↓ 10 callersFunctionforward_step
Forward step for passed-in model. If it is the first stage, the input tensor is obtained from the data_iterator. Otherwise, the passed-in inp
megatron/core/pipeline_parallel/schedules.py:173
↓ 10 callersFunctionget_default_save_sharded_strategy
Get default save sharded strategy.
megatron/core/dist_checkpointing/serialization.py:408
↓ 10 callersFunctionget_rerun_state_machine
Helper function to return the singleton instance of the rerun machine.
megatron/core/rerun_state_machine.py:1084
↓ 10 callersMethodreload_model_params
(self)
megatron/core/optimizer/optimizer.py:857
↓ 10 callersMethodset
(self, key, model, params)
tools/checkpoint/schema_base.py:81
↓ 10 callersFunctionset_global_variables
Set args, tokenizer, tensorboard-writer, adlr-autoresume, and timers.
megatron/training/global_vars.py:76
↓ 10 callersMethodshared_embedding_or_output_weight
Function to share the input embeddings and output logit weights.
megatron/core/models/T5/t5_model.py:376
↓ 10 callersMethodstep
Set lr for all parameters groups. Args: increment (int): number of steps to increment
megatron/core/optimizer_param_scheduler.py:182
↓ 10 callersFunctionupdate_num_microbatches
Update number of microbatches. Args: consumed_samples (int): Number of samples consumed. consistency_check (bool, opt
megatron/core/num_microbatches_calculator.py:38
↓ 10 callersFunctionvalidate_args
(args, defaults={})
megatron/training/arguments.py:188
↓ 9 callersMethod_check_and_set
Auxiliary function for checking the values in the checkpoint and setting them. Args: cls_value (float): class value
megatron/core/optimizer_param_scheduler.py:211
↓ 9 callersFunction_communicate
Communicate tensors between stages. Used as helper method in other communication methods that are used in megatron/schedules.py. Args:
megatron/core/pipeline_parallel/p2p_communication.py:230
↓ 9 callersMethodactive_time
Returns the active time.
megatron/core/timers.py:157
↓ 9 callersFunctionbroadcast_from_last_to_first_pipeline_stage
Broadcast tensor values from last stage into the first stage.
megatron/inference/text_generation/communication.py:104
↓ 9 callersFunctioncheck_message
(msg)
tools/checkpoint/saver_core.py:79
↓ 9 callersFunctionget_linear_layer
Simple linear layer with weight initialization.
megatron/legacy/model/utils.py:36
↓ 9 callersFunctionget_pipeline_model_parallel_world_size
Return world size for the pipeline-model-parallel group.
megatron/core/parallel_state.py:1206
↓ 9 callersFunctionget_pp_offsets
()
tests/unit_tests/dist_checkpointing/models/test_moe_experts.py:74
↓ 9 callersMethodget_states
Get rng states. Copy the dictionary so we have direct pointers to the states, not just a pointer to the dictionary.
megatron/core/tensor_parallel/random.py:110
↓ 9 callersFunctionget_tensorboard_writer
Return tensorboard writer. It can be None so no need to check if it is initialized.
megatron/training/global_vars.py:35
↓ 9 callersFunctionget_wandb_writer
Return tensorboard writer. It can be None so no need to check if it is initialized.
megatron/training/global_vars.py:41
↓ 9 callersFunctionimport_module
Import a named object from a module in the context of this function. TODO: make this importer module more robust, at least make sure there ar
megatron/core/transformer/spec_utils.py:30
↓ 9 callersFunctionis_float8tensor
Check if a tensor is a Transformer Engine Float8Tensor
megatron/core/dist_checkpointing/exchange_utils.py:32
↓ 9 callersFunctionmaybe_finalize_async_save
Finalizes active async save calls. Args: blocking (bool, optional): if True, will wait until all active requests are done. O
megatron/training/async_utils.py:28
↓ 9 callersMethodnarrow
This is an analogue of torch.narrow for ShardedTensors. Narrowing assumes that we narrow a local tensor on each rank. This has conseq
megatron/core/dist_checkpointing/mapping.py:355
↓ 9 callersFunctionqueue_get
(name=None)
tools/checkpoint/saver_legacy.py:45
↓ 9 callersFunctionqueue_put
(name, msg)
tools/checkpoint/loader_core.py:285
↓ 9 callersFunctionsave_to_aux_losses_tracker
Save the auxiliary loss for logging. Args: name (str): The name of the loss. loss (torch.Tensor): The loss tensor. layer_n
megatron/core/transformer/moe/moe_utils.py:654
↓ 9 callersMethodset_input_tensor
See megatron.legacy.model.transformer.set_input_tensor()
tasks/vision/segmentation/seg_models.py:38
↓ 9 callersMethodtokenize
(self, text)
megatron/training/tokenizer/tokenizer.py:780
↓ 9 callersMethodwithout_data
Returns a new ShardedBase instance with data=None.
megatron/core/dist_checkpointing/mapping.py:44
↓ 8 callersMethod__init__
(self, drop_prob=0.)
megatron/legacy/model/transformer.py:80
↓ 8 callersMethod__init__
( self, input_size: int, output_size: int, *, parallel_mode: str,
megatron/core/extensions/transformer_engine.py:103
↓ 8 callersFunction_ensure_var_is_not_initialized
Make sure the input variable is not None.
megatron/training/global_vars.py:271
↓ 8 callersFunction_get_fn
args: y_true : 3-d ndarray in [batch_size, img_rows, img_cols] y_pred : 3-d ndarray in [batch_size, img_rows, img_cols] retur
tasks/vision/segmentation/metrics.py:68
↓ 8 callersFunction_get_keys_endswith
Retrieve keys from the model that end with a specified suffix.
megatron/core/transformer/moe/upcycling_utils.py:6
↓ 8 callersFunction_initialize_affine_weight_cpu
Initialize affine weight for model parallel. Build the master weight on all processes and scatter the relevant chunk.
megatron/core/tensor_parallel/layers.py:126
↓ 8 callersFunction_test_domain_module_imports
(module, subdomains: list)
tests/unit_tests/test_imports.py:63
↓ 8 callersFunctionaverage_losses_across_data_parallel_group
Reduce a tensor of losses across all GPUs.
megatron/training/utils.py:138
↓ 8 callersFunctionbuild_data_loader
Data loader. Note that batch-size is the local (per GPU) batch-size.
tasks/vision/finetune_utils.py:29
↓ 8 callersFunctionbuild_pretraining_data_loader
Build dataloader given an input dataset.
megatron/legacy/data/data_samplers.py:21
↓ 8 callersFunctionbuild_tokenizer
Initialize tokenizer.
megatron/training/tokenizer/tokenizer.py:21
↓ 8 callersFunctionchunk_weight
(weight, parallel_mode, tp_size=1, ep_size=1)
tools/checkpoint/saver_core.py:345
↓ 8 callersFunctionclean_text
Remove new lines and multiple spaces and adjust end of sentence dot.
tasks/data_utils.py:9
↓ 8 callersMethodconvert
Convert model weights to trtllm model weights This method goes through each layer in the model state dict and converts to equivalent trtllm m
megatron/core/export/trtllm/trtllm_weights_converter/distributed_trtllm_model_weights_converter.py:228
↓ 8 callersMethodconvert
Multiple with alpha and add beat with clip.
tasks/vision/segmentation/transforms.py:52
↓ 8 callersMethoddecode
Convert list of token IDs to plaintext.
tests/unit_tests/test_tokenizer.py:210
↓ 8 callersMethoddecoder
(self)
megatron/training/tokenizer/tokenizer.py:770
↓ 8 callersFunctionget_checkpoint_tracker_filename
Tracker file rescords the latest chckpoint during training to restart from.
megatron/training/checkpointing.py:222
↓ 8 callersFunctionget_global_memory_buffer
Return the global GlobalMemoryBuffer object
megatron/core/parallel_state.py:1746
↓ 8 callersFunctionget_model_config
Returns the config attribute, allowed to return None
megatron/core/utils.py:154
↓ 8 callersMethodget_trtllm_pretrained_config_and_model_weights
Get TRTLLM Config and Converted Model Weights This function returns the trtllm model weights as a list. There are two modes for conve
megatron/core/export/trtllm/trtllm_helper.py:239
↓ 8 callersFunctioninitialize_expert_layer
(seed, glu=True, expert_type='sequential', fp8=False, **config_kwargs)
tests/unit_tests/dist_checkpointing/models/test_moe_experts.py:32
↓ 8 callersFunctionprint_datetime
Note that this call will sync across all ranks.
megatron/training/training_nan_skipping.py:117
↓ 8 callersFunctionprint_datetime
Note that this call will sync across all ranks.
megatron/training/training.py:113
↓ 8 callersMethodput
A patched version of put, implementing PR 3544 and PR 4295.
megatron/core/ssm/triton_cache_manager.py:51
↓ 8 callersFunctionreduce_scatter_to_sequence_parallel_region
Wrapper for autograd function: forward: RS, backward AG <fisrt dim>
megatron/core/tensor_parallel/mappings.py:505
↓ 8 callersMethodrename_input_layer_names_to_trtllm_layer_names
Helper function to rename model layer names to TRTLLM Layer names We go through each layer (keys) in the model state dict, and map it
megatron/core/export/trtllm/trtllm_layers.py:71
↓ 8 callersFunctionresize
(input, size=None, scale_factor=None, mode='nearest', align_corner
megatron/legacy/model/vision/utils.py:7
↓ 8 callersMethodsample_from_logits
Samples the logits to generate outputs Given the logits of the last token, this function samples it according to the parameters defin
megatron/core/inference/text_generation_controllers/text_generation_controller.py:67
↓ 8 callersFunctionsave_checkpoint_and_time
(iteration, model, optimizer, opt_param_scheduler, num_floating_point_operations_
megatron/training/training.py:1280
↓ 8 callersMethodset_mode
Method to set the operating mode
megatron/core/rerun_state_machine.py:213
↓ 8 callersMethodshared_embedding_or_output_weight
(self)
megatron/legacy/model/module.py:39
↓ 8 callersFunctionto_local_if_dtensor
Returns the local shard of the given tensor if it is a DTensor.
megatron/core/utils.py:489
↓ 7 callersMethod__init__
(self, vocab_size)
megatron/training/tokenizer/tokenizer.py:775
↓ 7 callersMethod_build_b1ss_attention_mask
Build an attention-mask having shape (bs, 1, q_len, kv_len) from source_block and target_block Args: source_block (torch.
megatron/core/datasets/t5_dataset.py:96
↓ 7 callersMethod_build_state_dict
(self, random=False)
tests/unit_tests/dist_checkpointing/test_flattened_resharding.py:157
↓ 7 callersMethod_checkpointed_forward
Forward method with activation checkpointing.
megatron/core/transformer/transformer_block.py:275
↓ 7 callersMethod_get_base_state_dict
(self)
tests/unit_tests/dist_checkpointing/test_serialization.py:612
↓ 7 callersFunction_get_fp
args: y_true : 3-d ndarray in [batch_size, img_rows, img_cols] y_pred : 3-d ndarray in [batch_size, img_rows, img_cols] retur
tasks/vision/segmentation/metrics.py:48
↓ 7 callersMethod_get_layer_offset
Get the index offset of current pipeline stage, given the level of pipelining.
megatron/core/transformer/transformer_layer.py:178
↓ 7 callersMethodadd
Track the rng state.
megatron/core/tensor_parallel/random.py:124
↓ 7 callersFunctioncheck_message
(msg)
tools/checkpoint/saver_legacy.py:58
↓ 7 callersFunctiondeallocate_output_tensor
Pseudo-deallocate (i.e., set to scalar) the output tensor's '.data' field. This method should be called right after the output tensor has been
megatron/core/pipeline_parallel/schedules.py:115
↓ 7 callersFunctiondetermine_global_metadata
Exchanges local metadata with `all_gather_object` to determine global metadata. Args: sharded_state_dict (ShardedStateDict): local sharde
megatron/core/dist_checkpointing/validation.py:520
↓ 7 callersFunctiongenerate_and_post_process
Run inference and post-process outputs, i.e., detokenize, move to cpu and convert to list. Args: data_parallel (bool): Enable data pa
megatron/inference/text_generation/api.py:19
↓ 7 callersFunctionget_blocks_by_rank
Divide existing and missing blocks evenly across all ranks. See 'get_blocks()' above for description. The returned lists of existing and miss
megatron/core/datasets/retro/utils.py:191
↓ 7 callersMethodget_cuda_graph_optional_args
Get optional tensor arguments for CUDA graph.
megatron/core/transformer/transformer_block.py:379
↓ 7 callersFunctionget_data_parallel_rank
Return caller's rank in the data-parallel group.
megatron/core/parallel_state.py:1533
← previousnext →101–200 of 4,219, ranked by callers