MCPcopy Create free account

hub / github.com/JinjieNi/MegaDLMs / functions

Functions4,219 in github.com/JinjieNi/MegaDLMs

↓ 3 callersFunctionget_expert_model_parallel_group
Get the expert-model-parallel group the caller rank belongs to.
megatron/core/parallel_state.py:1582
↓ 3 callersFunctionget_expert_model_parallel_rank
Return caller's rank in the expert-model-parallel group.
megatron/core/parallel_state.py:1607
↓ 3 callersFunctionget_expert_parallel_rng_tracker_name
Get the expert parallel rng tracker name
megatron/core/tensor_parallel/random.py:65
↓ 3 callersFunctionget_gpt_data_dir
Get project-relative directory of GPT bin/idx datasets.
megatron/core/models/retro/utils.py:13
↓ 3 callersFunctionget_indexed_dataset_infos
Load indexed dataset meta-infos. Args: project_dir (str): Path to Retro project dir. Returns: List of metadata for each data
megatron/core/datasets/retro/db/utils.py:119
↓ 3 callersFunctionget_indexed_dataset_infos_path
Path to indexed dataset meta-infos. Args: project_dir (str): Path to Retro project dir. Returns: Path to the `indexed_datase
megatron/core/datasets/retro/db/utils.py:66
↓ 3 callersFunctionget_individual_db_paths
Get paths of all database blocks of an individual dataset. Args: project_dir (str): Path to Retro project dir. prefix (str): Uniq
megatron/core/datasets/retro/db/utils.py:153
↓ 3 callersFunctionget_linear_layer
Simple linear layer with weight initialization.
megatron/core/transformer/utils.py:21
↓ 3 callersMethodget_mamba_block
(self, hybrid_override_pattern)
tests/unit_tests/ssm/test_mamba_block.py:24
↓ 3 callersFunctionget_merged_dataset
Get merged dataset. Args: project_dir (str): Path to Retro project dir. chunk_length (int): GPT chunk length (e.g., 64).
megatron/core/datasets/retro/db/utils.py:243
↓ 3 callersFunctionget_param_id_to_sharded_param_map
Generate mapping from optimizer state ids to model sharded parameters. Args: model_sharded_state_dict: sharded state dict with all model
megatron/core/dist_checkpointing/optimizer.py:39
↓ 3 callersFunctionget_pipeline_model_parallel_next_rank
Return the global rank that follows the caller in the pipeline, for each pipeline-parallel group that the rank is part of. If it is just part
megatron/core/parallel_state.py:1475
↓ 3 callersFunctionget_pipeline_model_parallel_prev_rank
Return the global rank that precedes the caller in the pipeline, for each pipeline-parallel group that the rank is part of. If it is just par
megatron/core/parallel_state.py:1493
↓ 3 callersFunctionget_pp_offsets
()
tests/unit_tests/dist_checkpointing/models/test_mlp_glu.py:37
↓ 3 callersFunctionget_pp_offsets
()
tests/unit_tests/dist_checkpointing/models/test_mamba.py:51
↓ 3 callersFunctionget_query_dir
Get root directory of all saved query data. Args: project_dir (str): Retro project dir. Returns: Path to query sub-directory
megatron/core/datasets/retro/query/utils.py:10
↓ 3 callersMethodget_query_key_value_tensors
This method needs to be implemented based on whether the derived class is "self-attn" or "cross-attn".
megatron/core/transformer/attention.py:281
↓ 3 callersFunctionget_t5_decoder_with_transformer_engine_block_spec
T5 decoder block spec for Transformer Engine Args: config (TransformerConfig): config, containing number of layers for decoder
megatron/core/models/T5/t5_spec.py:213
↓ 3 callersFunctionget_t5_encoder_with_transformer_engine_block_spec
T5 encoder block spec for Transformer Engine Args: config (TransformerConfig): config, containing number of layers for encoder
megatron/core/models/T5/t5_spec.py:199
↓ 3 callersFunctionget_training_data_block_dir
Get directory for of saved embedding blocks. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: P
megatron/core/datasets/retro/index/utils.py:66
↓ 3 callersFunctionget_training_data_merged_path
Get path to merged training embeddings. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: Path t
megatron/core/datasets/retro/index/utils.py:90
↓ 3 callersFunctionget_training_data_root_dir
Get root directory for embeddings (blocks and merged data). Args: config (RetroPreprocessingConfig): Retro preprocessing config. Ret
megatron/core/datasets/retro/index/utils.py:54
↓ 3 callersFunctionget_virtual_pipeline_model_parallel_rank
Return the virtual pipeline-parallel rank.
megatron/core/parallel_state.py:1409
↓ 3 callersFunctiongpt2_merge
(odir)
tests/unit_tests/data/test_preprocess_data.py:177
↓ 3 callersFunctiongpt2_vocab
(odir)
tests/unit_tests/data/test_preprocess_data.py:168
↓ 3 callersMethodhave_requests_pending
Method to check if there are requests pending This method returns False only when there are no active requests or waiting requests.
megatron/core/inference/scheduler.py:77
↓ 3 callersMethodinit
Initialize Megatron, tokenizers, and datasets.
tools/retro/cli/cli.py:36
↓ 3 callersMethodinit_state_dict_from_bert
Initialize the state from a pretrained BERT model on iteration zero of ICT pretraining
megatron/legacy/model/realm_model.py:118
↓ 3 callersMethodinitialize_word_embeddings
(self)
megatron/legacy/model/module.py:49
↓ 3 callersFunctionisPerfectSquare
(x)
megatron/legacy/model/vision/vit_backbone.py:50
↓ 3 callersFunctionis_float8tensor
Check if a tensor is a Transformer Engine Float8Tensor
megatron/core/utils.py:1413
↓ 3 callersMethodload
Distributes the load and calls underlying strategy only for parts of the state dict. Steps: 1. Load metadata is exchanged between the
megatron/core/dist_checkpointing/strategies/fully_parallel.py:174
↓ 3 callersFunctionload_args_from_checkpoint
Set required arguments from the checkpoint specified in the arguments. Will overwrite arguments that have a non-None default value, but w
megatron/training/checkpointing.py:998
↓ 3 callersMethodload_parameter_state_from_dp_zero
Load parameter state (i.e., parameter & optimizer tensors) from DP 0 rank, using the new checkpoint format with coalesced state across buckets
megatron/core/optimizer/distrib_optimizer.py:1404
↓ 3 callersMethodload_state_dict
(self, state_dict)
megatron/core/optimizer/optimizer.py:863
↓ 3 callersFunctionload_zarr_based_sharded_metadata
Load metadata of Zarr arrays. Args: checkpoint_dir (str): checkpoint root directory get_shape_dtype_fn (str -> ((int, ...), np.dt
megatron/core/dist_checkpointing/strategies/zarr.py:295
↓ 3 callersFunctionlog_single_rank
(logger: logging.Logger, *args: Any, rank: int = 0, **kwargs: Any)
megatron/core/ssm/mamba_hybrid_layer_allocation.py:10
↓ 3 callersFunctionmain
()
tasks/vision/segmentation/finetune_segformer.py:237
↓ 3 callersFunctionmake_tp_sharded_tensor_for_checkpoint
Helper for instantiating a ShardedTensor where the `tp_axis` dimension is sharded across TP group. Optionally, can provide offsets which prep
megatron/core/utils.py:409
↓ 3 callersFunctionmerge_dbs
Merge individual DBs into single DB. Args: project_dir (str): Retro project dir. indexed_dataset_infos (List[Dict]): Preprocessin
megatron/core/datasets/retro/db/build.py:455
↓ 3 callersFunctionmodel_provider
Builds the model. If you set the use_legacy_models to True, it will return the legacy GPT model and if not the mcore GPT model. Args:
pretrain_difflm.py:51
↓ 3 callersFunctionnd_flattened_tensor_reformulated_global_shape
Reformulated global shape of the flattened N-D ShardedTensor. N-D tensor global shape [X, Y, Z] and local shape [x, y, z] is reformulated int
megatron/core/dist_checkpointing/strategies/resharding.py:60
↓ 3 callersFunctionnormalize_answer
(s)
tools/retro/text_generation/evaluate.py:17
↓ 3 callersFunctionopen_ts_array
Opens a Zarr file array with Tensorstore with basic setting. Args: arr_path (Path): path to a Zarr (Tensorstore) array
megatron/core/dist_checkpointing/strategies/tensorstore.py:116
↓ 3 callersFunctionoptim_state_to_sharding_state
Turn optimizer state dict to sharded state dict based on model state dict *in-place*. Can be used to add sharding information to most common opti
megatron/core/dist_checkpointing/optimizer.py:103
↓ 3 callersMethodoptimal_dtype
Get the dtype to use for an index of a certain cardinality Args: cardinality (Optional[int]): The number of elements to be indexe
megatron/core/datasets/indexed_dataset.py:98
↓ 3 callersFunctionparallel_lm_logits
LM logits using word embedding weights.
megatron/legacy/model/language_model.py:19
↓ 3 callersFunctionparse_and_normalize_split
Parse the dataset split ratios from a string Args: split (str): The train valid test split string e.g. "99,1,0" Returns: Lis
megatron/core/datasets/blended_megatron_dataset_config.py:115
↓ 3 callersFunctionparse_s3_path
Parses the given S3 path returning correspsonding bucket and key. Args: path (str): The S3 path Returns: Tuple[str, str]: A
megatron/core/datasets/utils_s3.py:60
↓ 3 callersFunctionpartition_buckets
Automatically regroup the buckets of input buffers and return a list of bucket groups. In some scenarios, we need to put buckets from differ
megatron/core/distributed/param_and_grad_buffer.py:731
↓ 3 callersFunctionpermute
(qkv_w)
tools/weights_conversion/hf_to_megatron_te.py:71
↓ 3 callersFunctionpermute
(x)
tools/weights_conversion/utils/permute_qkv.py:13
↓ 3 callersFunctionpermute
Permute the tokens and probs based on the mask. Tokens with the same designated expert will be grouped together. The shape of mask is [tokens,
megatron/core/transformer/moe/moe_utils.py:232
↓ 3 callersMethodpost_forward
Reshapes tensor from [s, b] to [b, s] for upcoming loss masking.
megatron/inference/algos/distillation.py:114
↓ 3 callersMethodpre_forward
Performs projection of student tensor to match teacher's size if necessary.
megatron/inference/algos/distillation.py:103
↓ 3 callersFunctionprefix_product
(a: List[int], init=1)
megatron/core/parallel_state.py:198
↓ 3 callersFunctionprint_split_stats
(name, index)
megatron/legacy/data/dataset_utils.py:487
↓ 3 callersMethodrand_init_model_params
Randomly initialize model params.
tests/functional_tests/test_cases/common/ckpt_converter/__main__.py:362
↓ 3 callersFunctionrearrange_qkv
(wq, wk, wv)
tools/weights_conversion/hf_to_megatron_te.py:134
↓ 3 callersFunctionrecv_forward
Wrapper for p2p_communication.recv_forward used with non-interleaving schedule.
megatron/core/pipeline_parallel/schedules.py:1537
↓ 3 callersFunctionreduce_from_tensor_model_parallel_region
Wrapper for autograd function: forward: all reduce, backward copy
megatron/core/tensor_parallel/mappings.py:472
↓ 3 callersFunctionreport_theoretical_memory
(args, num_microbatches=None, verbose=False)
megatron/training/theoretical_memory_usage.py:166
↓ 3 callersMethodreset
Reset timer.
megatron/core/timers.py:127
↓ 3 callersMethodreset
Set to the initial state (no tracker).
megatron/core/tensor_parallel/random.py:98
↓ 3 callersFunctionscaled_init_method_normal
Init method based on N(0, sigma/sqrt(2*num_layers).
megatron/legacy/model/utils.py:21
↓ 3 callersMethodset_epoch
(self, epoch)
tasks/vision/segmentation/data.py:86
↓ 3 callersFunctionset_jit_fusion_options
Set PyTorch JIT layer fusion options.
megatron/training/initialize.py:371
↓ 3 callersMethodset_world_size
(world_size=None, rank=None)
tests/unit_tests/test_utilities.py:71
↓ 3 callersMethodsetup_model
(self, tensor_parallel_size, pipeline_parallel_size)
tests/unit_tests/inference/model_inference_wrappers/gpt/test_gpt_inference_wrapper.py:24
↓ 3 callersFunctionshard_buffer
Shard buffer into data_parallel_world_size chunks of equal size.
megatron/core/distributed/param_and_grad_buffer.py:37
↓ 3 callersMethodsharded_state_dict
Generate a sharded state dictionary for the transformer layer. Args: prefix (str, optional): Prefix to be added to all k
megatron/core/transformer/transformer_layer.py:378
↓ 3 callersFunctionsharded_tensor_chunk_id
(sharded_tensor: ShardedTensor)
megatron/core/dist_checkpointing/strategies/two_stage.py:61
↓ 3 callersMethodtokenize_conversation
Convert a conversation to tokens. Args: conversation (List[Dict]): Sequence of system/user/assistant messages. Mu
megatron/training/tokenizer/multimodal_tokenizer.py:166
↓ 3 callersFunctiontokens_to_string
(toks)
tests/unit_tests/data/test_preprocess_mmdata.py:94
↓ 3 callersFunctiontokens_to_string
(toks)
tests/unit_tests/data/test_preprocess_data.py:94
↓ 3 callersFunctiontopk_softmax_with_capacity
Apply capacity and padding to the top-k selection. Args: logits (torch.Tensor): Logits tensor. topk (int): The number of experts t
megatron/core/transformer/moe/moe_utils.py:353
↓ 3 callersFunctiontrain_step
Single training step.
megatron/training/training.py:877
↓ 3 callersFunctiontraining_log
Log training information such as losses, timing, ....
megatron/training/training.py:977
↓ 3 callersFunctionunset_global_variables
Unset global vars. Useful for multiple runs. See `tests/unit_tests/ckpt_converter/test_ckpt_converter.py` for an example.
megatron/training/global_vars.py:104
↓ 3 callersMethodupdate_requests_pools
Update request pool status This method will full up the active request pool, if it has less than max batch size elements from the wai
megatron/core/inference/scheduler.py:101
↓ 3 callersFunctionupdate_use_dist_ckpt
(args)
megatron/training/utils.py:471
↓ 3 callersMethodvalidate_result
This method verifies a result and possibly triggers a re-run. Args: result: result to verify. rejection_func: functio
megatron/core/rerun_state_machine.py:407
↓ 3 callersFunctionvalidate_sharded_objects_handling
Checks if either of the passed strategies can handle sharded objects. Args: sharded_strategy (Union[SaveShardedStrategy, LoadShardedStrat
megatron/core/dist_checkpointing/validation.py:537
↓ 3 callersMethodvocab_size
(self)
megatron/training/tokenizer/tokenizer.py:795
↓ 3 callersFunctionwhitespace_tokenize
Runs basic whitespace cleaning and splitting on a piece of text.
megatron/training/tokenizer/bert_tokenization.py:155
↓ 3 callersMethodwords
Returns a list of the text of each token Args: uncased: lower cases text
tasks/orqa/unsupervised/tokenizers.py:52
↓ 2 callersMethod__enter__
Enter the context introduced by the 'with' keyword Returns: _IndexWriter: The instance
megatron/core/datasets/indexed_dataset.py:126
↓ 2 callersMethod__exit__
Exit the context introduced by the 'with' keyword Args: exc_type (Optional[Type[BaseException]]): Exception type exc
megatron/core/datasets/indexed_dataset.py:141
↓ 2 callersMethod__init__
(self, hidden_size, init_method)
megatron/legacy/model/language_model.py:100
↓ 2 callersMethod__init__
(self, input_dim=2048, embed_dim=768)
megatron/legacy/model/vision/inpainting.py:74
↓ 2 callersMethod__init__
( self, *args, dedup_replicated_tensors: Optional[bool] = None, nd_flattened_g
megatron/core/dist_checkpointing/strategies/torch.py:458
↓ 2 callersMethod__init__
( self, indexed_dataset: IndexedDataset, dataset_path: Optional[str], indexed_
megatron/core/datasets/gpt_dataset.py:92
↓ 2 callersMethod__init__
( self, config: TransformerConfig, submodules: TransformerLayerSubmodules, lay
megatron/core/transformer/transformer_layer.py:87
↓ 2 callersMethod__init__
( self, config: TransformerConfig, spec: Union[TransformerBlockSubmodules, ModuleSpec]
megatron/core/transformer/transformer_block.py:188
↓ 2 callersMethod__init__
Initialize the MoE Token Dispatcher.
megatron/core/transformer/moe/token_dispatcher.py:44
↓ 2 callersMethod__init__
(self, num_local_experts: int, config: TransformerConfig)
megatron/core/transformer/moe/experts.py:93
↓ 2 callersMethod__init__
( self, config: TransformerConfig, submodules: MLPSubmodules = None, layer_number: int = None )
megatron/core/transformer/moe/moe_layer.py:80
↓ 2 callersMethod__init__
Initialize the Router module. Args: config (TransformerConfig): Configuration object for the Transformer model.
megatron/core/transformer/moe/router.py:31
↓ 2 callersMethod__init__
(self, input_dim=2048, embed_dim=768)
tasks/vision/segmentation/seg_heads.py:59
↓ 2 callersMethod__next__
(self)
megatron/core/inference/utils.py:11
← previousnext →501–600 of 4,219, ranked by callers