Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/JinjieNi/MegaDLMs
/ functions
Functions
4,219 in github.com/JinjieNi/MegaDLMs
⨍
Functions
4,219
◇
Types & classes
650
↳
Endpoints
8
↓ 2 callers
Function
get_moe_module_spec
Helper function to get module spec for MoE
megatron/core/models/difflm/moe_module_specs.py:27
↓ 2 callers
Function
get_num_chunks_per_sample
Compute seq_length // chunk_length. Args: sample_length (int): Alias of `sequence_length`. chunk_length (int): Retro chunk length
megatron/core/datasets/retro/utils.py:61
↓ 2 callers
Method
get_num_layers
(self, model)
tools/checkpoint/schema_base.py:57
↓ 2 callers
Function
get_open_retrieval_wiki_dataset
()
megatron/legacy/data/orqa_wiki_dataset.py:16
↓ 2 callers
Function
get_pairs
Return set of symbol pairs in a word. Word is represented as tuple of symbols (symbols being variable-length strings).
megatron/training/tokenizer/gpt2_tokenization.py:79
↓ 2 callers
Function
get_pos_emb_on_this_cp_rank
Get the position embedding on the current context parallel rank. Args: pos_emb (Tensor): Positional embedding tensor seq_dim (int
megatron/core/models/common/embeddings/rope_utils.py:49
↓ 2 callers
Method
get_pt_num_samples_and_chunks
Number of samples & chunks (e.g., 32*n_samples) in corpus.
tools/retro/cli/cli.py:145
↓ 2 callers
Method
get_pt_sample
(cls, data_key: str, idx: int)
tools/retro/cli/cli.py:172
↓ 2 callers
Function
get_reformulation_metadata
Reads MCore data for N-D flattened tensors from checkpoint metadata during ckpt load. Args: sharded_state_dict (ShardedStateDict): sharde
megatron/core/dist_checkpointing/strategies/torch.py:715
↓ 2 callers
Function
get_rng_state
collect rng state across data parallel ranks
megatron/training/checkpointing.py:277
↓ 2 callers
Method
get_sharded_state_dict
()
tests/unit_tests/dist_checkpointing/test_fully_parallel.py:83
↓ 2 callers
Function
get_signal_handler
()
megatron/training/global_vars.py:64
↓ 2 callers
Function
get_split_dim
(tensor_name)
tools/checkpoint/hybrid_conversion.py:45
↓ 2 callers
Method
get_start_end_idx
(self)
megatron/legacy/data/data_samplers.py:89
↓ 2 callers
Function
get_swin
(is_teacher=False)
megatron/legacy/model/vision/esvit_swin_backbone.py:810
↓ 2 callers
Function
get_target_sample_len
megatron/core/datasets/helpers.cpp:248
↓ 2 callers
Function
get_te_version
Included for backwards compatibility.
megatron/core/models/bert/bert_model.py:28
↓ 2 callers
Function
get_tensor_and_context_parallel_group
Get the tensor- and context-parallel group the caller rank belongs to.
megatron/core/parallel_state.py:1172
↓ 2 callers
Function
get_tensor_model_parallel_src_rank
Calculate the global rank corresponding to the first local rank in the tensor model parallel group.
megatron/core/parallel_state.py:1427
↓ 2 callers
Function
get_tensor_shapes
Determine right tensor sizes (based on position of rank with respect to split rank) and model size. Send two tensors if model decoder req
megatron/core/pipeline_parallel/schedules.py:1492
↓ 2 callers
Function
get_tensor_shapes_for_tp
(transformer_config, tp_size)
tests/unit_tests/transformer/test_transformer_layer.py:100
↓ 2 callers
Function
get_test_vocab_size
(make_divisible_by=128)
tests/unit_tests/dist_checkpointing/models/common.py:175
↓ 2 callers
Function
get_text_dataset_for_adding
Convert GPT token chunk dataset to a text dataset for passing to the embedder. Args: config (RetroPreprocessingConfig): Retro preproc
megatron/core/datasets/retro/index/build.py:232
↓ 2 callers
Function
get_text_dataset_for_training
Convert GPT token chunk dataset to a text dataset for passing to the embedder. Args: config (RetroPreprocessingConfig): Retro preproc
megatron/core/datasets/retro/index/build.py:115
↓ 2 callers
Function
get_tokenizers
(config)
tools/retro/preprocess_data.py:192
↓ 2 callers
Function
get_train_valid_test_num_samples
Train/valid/test num samples.
megatron/training/training.py:2043
↓ 2 callers
Function
get_virtual_pipeline_model_parallel_world_size
Return the virtual pipeline-parallel world size.
megatron/core/parallel_state.py:1421
↓ 2 callers
Function
get_vit_layer_with_transformer_engine_spec
Returns ViT layer spec with Transformer Engine layers
megatron/core/models/vision/vit_layer_specs.py:35
↓ 2 callers
Function
get_words
(text)
tools/openwebtext/filter_ngrams.py:20
↓ 2 callers
Function
get_world_max
Get max value across ranks. Args: n (int): Value on this rank. Returns: Max value across all ranks.
megatron/core/datasets/retro/utils.py:231
↓ 2 callers
Function
grouped_gemm_is_available
Check if grouped_gemm is available.
megatron/core/transformer/moe/grouped_gemm_util.py:9
↓ 2 callers
Function
has_file_allowed_extension
Checks if a file is an allowed extension. Args: filename (string): path to a file extensions (tuple of strings): extensions to con
megatron/legacy/data/image_folder.py:43
↓ 2 callers
Method
init_args_and_model
Initialize Megatron and build model.
tests/functional_tests/test_cases/common/ckpt_converter/__main__.py:126
↓ 2 callers
Method
initialize
Initialize the dataset This method is called by IndexedDataset.__init__ during object creation and by IndexedDataset.__setstate__ dur
megatron/core/datasets/indexed_dataset.py:542
↓ 2 callers
Function
initialize_mamba
(seed, glu=True, **config_kwargs)
tests/unit_tests/dist_checkpointing/models/test_mamba.py:28
↓ 2 callers
Function
initialize_mlp
(glu=True)
tests/unit_tests/dist_checkpointing/models/test_mlp_glu.py:22
↓ 2 callers
Function
initialize_rerun_state_machine
Helper function to initialize the rerun machine instance. Check the RerunStateMachine class for the details.
megatron/core/rerun_state_machine.py:1067
↓ 2 callers
Function
initialize_retro_model
(seed, decoder_spec_fn, spec_type, num_layers=9, **config_kwargs)
tests/unit_tests/dist_checkpointing/models/test_retro_model.py:17
↓ 2 callers
Function
initialize_rng_tracker
Create the RNG tracker. 'use_te_rng_tracker' determines whether to use Megatron or TransformerEngine's implementation. In particular, Transfor
megatron/core/tensor_parallel/random.py:173
↓ 2 callers
Function
initialize_t5_model
(seed, encoder_decoder_spec_fn, num_layers=8, **config_kwargs)
tests/unit_tests/dist_checkpointing/models/test_t5_model.py:36
↓ 2 callers
Method
initializer
(self)
tools/preprocess_data.py:52
↓ 2 callers
Function
inner_product
(a: List[int], b: List[int])
megatron/core/parallel_state.py:205
↓ 2 callers
Function
insert_dict
(words, ngrams, pos)
tools/openwebtext/filter_ngrams.py:174
↓ 2 callers
Function
is_first_microbatch_for_model_chunk
Check if an iteration is the first for a model chunk.
megatron/core/pipeline_parallel/schedules.py:795
↓ 2 callers
Function
is_graph_capturing
Query if currently capturing.
megatron/core/transformer/cuda_graphs.py:35
↓ 2 callers
Function
is_last_microbatch_for_model_chunk
Check if an iteration is the last for a model chunk.
megatron/core/pipeline_parallel/schedules.py:802
↓ 2 callers
Function
is_megatron_path
(path: Path | str)
tools/weights_conversion/utils/verify_correctness_dlm.py:181
↓ 2 callers
Method
is_model_parallel_rank_0
(cls)
tests/functional_tests/test_cases/common/ckpt_converter/__main__.py:203
↓ 2 callers
Function
is_start_piece
Check if the current word piece is the starting piece (BERT).
megatron/legacy/data/dataset_utils.py:167
↓ 2 callers
Function
load_biencoder_checkpoint
selectively load retrieval models for indexing/retrieving from saved checkpoints
megatron/training/checkpointing.py:1446
↓ 2 callers
Method
load_checkpoint
Load checkpoint, and forward pass data.
tests/functional_tests/test_cases/common/ckpt_converter/__main__.py:407
↓ 2 callers
Method
load_common
Load common part of the checkpoint.
megatron/core/dist_checkpointing/strategies/base.py:116
↓ 2 callers
Function
load_config
Loads and parses a yaml file into a JETWorkloadManifest
tests/test_utils/python_scripts/common.py:62
↓ 2 callers
Method
load_from_file
Populate members from instance saved to file
megatron/legacy/data/realm_index.py:51
↓ 2 callers
Function
load_indexed_datasets
Loaded indexed datasets into memory-mapped datasets. Args: project_dir (str): Path to Retro project dir. indexed_dataset_infos (L
megatron/core/datasets/retro/db/utils.py:107
↓ 2 callers
Function
load_plugin
(plugin_type, name)
tools/checkpoint/convert.py:103
↓ 2 callers
Function
load_preprocess
Preprocesses the given state dictionary by applying factories and extracting non-persistent data, without modifying the original dictionary.
megatron/core/dist_checkpointing/state_dict_transformation.py:70
↓ 2 callers
Function
load_retro_config
Load Retro's config.json.
megatron/training/arguments.py:87
↓ 2 callers
Function
load_sharded_metadata
Load sharded metadata from the checkpoint. Similar to `load_tensors_metadata`, but includes also ShardedObjects. Returns a dictionary simila
megatron/core/dist_checkpointing/serialization.py:203
↓ 2 callers
Method
load_sharded_metadata
Load just the metadata from the checkpoint.
megatron/core/dist_checkpointing/strategies/base.py:127
↓ 2 callers
Method
load_state_dict
(self, state_dict, strict=True)
megatron/core/transformer/module.py:194
↓ 2 callers
Method
load_state_dict
Load the state dict. As detailed in state_dict(), the state dict contains all non- parameter-related variables. This method is notabl
megatron/core/optimizer/distrib_optimizer.py:611
↓ 2 callers
Method
load_tensors_metadata
Load tensors metadata from the checkpoint for ShardedTensors. Returns a dictionary similar to a sharded state dict, but note that the
megatron/core/dist_checkpointing/strategies/base.py:143
↓ 2 callers
Function
logical_and_across_model_parallel_group
This function gathers a bool value across the model parallel group
megatron/training/utils.py:170
↓ 2 callers
Function
loss_func
Loss function (with KD Loss support). Args: loss_mask (Tensor): Used to mask out some portions of the loss model (GPTModel): The
megatron/inference/gpt/loss_func.py:60
↓ 2 callers
Function
make_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/ict_dataset.py:13
↓ 2 callers
Function
make_sharded_object_for_checkpoint
Helper for instantiating a non-sharded ShardedObject (replicated across TP and DP group). Args: obj (object): any object to be sharded
megatron/core/transformer/utils.py:113
↓ 2 callers
Function
make_sharded_optimizer_tensor
Build a ShardedTensor or ShardedTensorFactory for optimizer param based on model param Args: model_param (Union[ShardedTensor, ShardedTen
megatron/core/dist_checkpointing/optimizer.py:75
↓ 2 callers
Function
make_sharded_tensor_for_checkpoint
Helper for instantiating a non-sharded ShardedTensor (replicated across TP and DP group). Optionally, can provide offsets which prepend new dimen
megatron/core/utils.py:456
↓ 2 callers
Function
maybe_report_missing_and_unexpected_keys
Raises or logs an error in case missing or unexpected keys are non-empty. Args: missing_keys (Set[str]): missing keys in the state dict
megatron/core/dist_checkpointing/validation.py:323
↓ 2 callers
Function
mcore_to_pyt_state_dict
Convert state dict with ShardedTensors and ShardedObjects to state dict compatible with PyT Dist format. Operates in-place and returns the or
megatron/core/dist_checkpointing/strategies/torch.py:304
↓ 2 callers
Function
modify_logits_for_top_k_filtering
Set the logits for none top-k values to -inf.
megatron/inference/text_generation/sampling.py:14
↓ 2 callers
Function
modify_logits_for_top_p_filtering
Set the logits for none top-p values to -inf.
megatron/inference/text_generation/sampling.py:22
↓ 2 callers
Function
nested_items_iter
Returns iterator over (nested) tuples (container, key, value) of a given dict or list.
megatron/core/dist_checkpointing/dict_utils.py:168
↓ 2 callers
Function
new_get_model_chunk_id
Helper method to get the model chunk ID given the iteration number.
tests/unit_tests/pipeline_parallel/test_helpers.py:71
↓ 2 callers
Method
new_moe_layer
(self)
tests/unit_tests/transformer/moe/test_token_dispatcher.py:77
↓ 2 callers
Function
normalize_answer
Lower text and remove punctuation, articles and extra whitespace.
tools/retro/text_generation/metrics.py:19
↓ 2 callers
Function
normalize_answer
Lower text and remove punctuation, articles and extra whitespace.
tasks/msdp/metrics.py:18
↓ 2 callers
Function
num_floating_point_operations
(args, batch_size)
megatron/training/training_nan_skipping.py:124
↓ 2 callers
Function
num_floating_point_operations
(args, batch_size)
megatron/training/training.py:120
↓ 2 callers
Function
object_exists
Ascertain whether the object at the given S3 path exists in S3 Args: client (S3Client): The S3 client path (str): The S3 path
megatron/core/datasets/utils_s3.py:80
↓ 2 callers
Method
offsets
(self, ids: list[int], text: str)
megatron/training/tokenizer/tokenizer.py:787
↓ 2 callers
Method
offsets
Returns a list of [start, end) character offsets of each token.
tasks/orqa/unsupervised/tokenizers.py:63
↓ 2 callers
Function
offsets_to_substrs
(offsets, string)
tests/unit_tests/test_tokenizer.py:22
↓ 2 callers
Function
pad_and_convert_to_numpy
Pad sequences and convert them to numpy.
tools/retro/sft/dataset_conv.py:420
↓ 2 callers
Function
pad_vocab_size
Pad vocab size based on inference size
megatron/core/export/trtllm/trtllm_weights_converter/single_device_trtllm_model_weights_converter.py:19
↓ 2 callers
Function
pad_weight
(orig_word_embed, true_vocab_size)
tools/checkpoint/saver_core.py:281
↓ 2 callers
Function
parallel_self_attention
(tensor_model_parallel_size, num_att_heads_per_partition, hidden_size_per_att_head
megatron/legacy/mpu/tests/test_layers.py:315
↓ 2 callers
Function
parallel_transformer
(tensor_model_parallel_size, num_att_heads_per_partition, hidden_size_per_att_head, b
megatron/legacy/mpu/tests/test_layers.py:400
↓ 2 callers
Function
param_is_not_shared
(param)
megatron/legacy/model/module.py:19
↓ 2 callers
Function
param_is_not_shared
(param)
megatron/core/transformer/module.py:23
↓ 2 callers
Function
param_is_not_tensor_parallel_duplicate
Returns true if the passed-in parameter is not a duplicate parameter on another TP rank.
megatron/core/tensor_parallel/layers.py:70
↓ 2 callers
Method
partition_input
(self, input)
tests/unit_tests/transformer/moe/test_aux_loss.py:13
↓ 2 callers
Function
pil_loader
(path: str)
megatron/legacy/data/image_folder.py:237
↓ 2 callers
Function
postprocess_numpy_array
Turn numpy array to torch tensor.
megatron/core/dist_checkpointing/strategies/zarr.py:228
↓ 2 callers
Method
prepare_gradient_calculation_operands
Prepare gradient calculation operands.
megatron/core/tensor_parallel/cross_entropy.py:85
↓ 2 callers
Method
prepare_grads
Pre-processing gradients before the optimizer step, returns whether inf/nan is found.
megatron/core/optimizer/optimizer.py:784
↓ 2 callers
Function
prepare_input_tensors_for_wgrad_compute
Ensure grad_output is stored in a contiguous buffer.
megatron/core/utils.py:506
↓ 2 callers
Function
prepare_state_dict_for_save
Creates a tensor-aware state dictionary that can be saved using the Local Checkpoint Manager. Args: sharded_state_dict (ShardedStateDict)
megatron/core/dist_checkpointing/state_dict_transformation.py:103
↓ 2 callers
Function
preprocess
(dataset_path: str, config: JsonQADatasetConfig)
tools/retro/sft/dataset_conv.py:181
← previous
next →
801–900 of 4,219, ranked by callers