Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/JieShibo/MoLE
/ functions
Functions
2,110 in github.com/JieShibo/MoLE
⨍
Functions
2,110
◇
Types & classes
358
↓ 1 callers
Method
enable_pre_hook
Enable forward pre-hook needed for param all-gather overlap with forward compute.
pretrain/megatron/core/optimizer/distrib_optimizer.py:493
↓ 1 callers
Function
encoder_model_with_local_spec
T5 encoder local spec (uses Megatron-Core components).
pretrain/megatron/core/models/T5/t5_spec.py:99
↓ 1 callers
Function
encoder_model_with_transformer_engine_default_spec
T5 encoder TE spec (uses Transformer Engine components).
pretrain/megatron/core/models/T5/t5_spec.py:30
↓ 1 callers
Function
ensure_divisibility
Ensure that numerator is divisible by the denominator.
pretrain/megatron/core/utils.py:14
↓ 1 callers
Function
evaluate
Evaluation.
pretrain/megatron/training/training.py:1137
↓ 1 callers
Function
extract_data_config
Extract data config from dataset. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: The config o
pretrain/megatron/core/datasets/retro/utils.py:49
↓ 1 callers
Function
extract_sharded_tensors_and_factories
Extract a dict consisting of only ShardedTensor and ShardedTensorFactory objects from a given state dict with any objects. Args: sharded
pretrain/megatron/core/dist_checkpointing/utils.py:35
↓ 1 callers
Method
filter
(self, record: LogRecord)
pretrain/megatron/training/log_handler.py:18
↓ 1 callers
Function
find_checkpoint_rank_0
Finds the checkpoint for rank 0 without knowing if we are using pipeline parallelism/expert parallelism or not. Since the checkpoint naming s
pretrain/megatron/training/checkpointing.py:128
↓ 1 callers
Function
finish_mpu_init
()
pretrain/megatron/training/initialize.py:62
↓ 1 callers
Method
finish_param_sync
Finish parameter synchronization for all optimizers.
pretrain/megatron/core/optimizer/optimizer.py:838
↓ 1 callers
Function
flatten_state_dict
Flattens state dict into a single level dict. It's a copy of torch.distributed.checkpoint._nested_dict.flatten_state_dict which also accepts
pretrain/megatron/core/dist_checkpointing/strategies/torch.py:50
↓ 1 callers
Function
float16_to_fp32
Convert fp16/bf16 `val` to fp32
pretrain/megatron/legacy/model/module.py:151
↓ 1 callers
Function
float16_to_fp32
(val)
pretrain/megatron/core/transformer/module.py:120
↓ 1 callers
Method
forward_all_selfattention
(self, x)
pretrain/megatron/legacy/model/vision/esvit_swin_backbone.py:653
↓ 1 callers
Method
forward_features
(self, x)
pretrain/megatron/legacy/model/vision/mit_backbone.py:296
↓ 1 callers
Method
forward_fused_softmax
(self, input, mask)
pretrain/megatron/legacy/model/fused_softmax.py:174
↓ 1 callers
Method
forward_fused_softmax
(self, input, mask)
pretrain/megatron/core/fusions/fused_softmax.py:172
↓ 1 callers
Method
forward_last_selfattention
(self, x)
pretrain/megatron/legacy/model/vision/esvit_swin_backbone.py:644
↓ 1 callers
Method
forward_torch_softmax
(self, input, mask)
pretrain/megatron/legacy/model/fused_softmax.py:192
↓ 1 callers
Method
forward_torch_softmax
(self, input, mask)
pretrain/megatron/core/fusions/fused_softmax.py:190
↓ 1 callers
Method
forward_with_features
(self, x)
pretrain/megatron/legacy/model/vision/esvit_swin_backbone.py:436
↓ 1 callers
Function
fp32_to_float16
Convert fp32 `val` to fp16/bf16
pretrain/megatron/legacy/model/module.py:139
↓ 1 callers
Function
fp32_to_float16
(val, float16_convertor)
pretrain/megatron/core/transformer/module.py:108
↓ 1 callers
Method
from_dir
Get list of block files, and create map. Args: dir (str): Path to directory containing saved block files. block_size
pretrain/megatron/core/datasets/retro/utils.py:306
↓ 1 callers
Function
gather_from_sequence_parallel_region_to_moe
(input_)
pretrain/megatron/core/tensor_parallel/mappings.py:459
↓ 1 callers
Function
gather_from_tensor_model_parallel_region
(input_)
pretrain/megatron/core/tensor_parallel/mappings.py:443
↓ 1 callers
Method
gather_indices
Gather tensors and concatinate along the first dimension.
pretrain/megatron/legacy/model/transformer.py:208
↓ 1 callers
Function
gather_split_1d_tensor
Opposite of split_tensor_into_1d_equal_chunks. Gather values from tensor model parallel ranks. Returns a new Tensor with the gathere
pretrain/megatron/core/tensor_parallel/utils.py:67
↓ 1 callers
Method
gating
Forward pass of the router gate. Args: input (torch.Tensor): Input tensor. Returns: torch.Tensor: Logits ten
pretrain/megatron/core/transformer/moe/router.py:53
↓ 1 callers
Function
gelu_impl
OpenAI's gelu implementation.
pretrain/megatron/legacy/model/utils.py:47
↓ 1 callers
Function
gelu_impl
OpenAI's gelu implementation.
pretrain/megatron/core/transformer/utils.py:41
↓ 1 callers
Method
gen_mask
(self, image_size, mask_size, mask_type, patch_size)
pretrain/megatron/legacy/data/vit_dataset.py:109
↓ 1 callers
Function
generate
Given prompts and input parameters, run inference and return: tokens: prompts plus the generated tokens. lengths: length of the prompt +
pretrain/megatron/inference/text_generation/api.py:76
↓ 1 callers
Function
generate_and_post_process
Run inference and post-process outputs, i.e., detokenize, move to cpu and convert to list.
pretrain/megatron/inference/text_generation/api.py:18
↓ 1 callers
Function
generate_tokens_probs_and_return_on_first_stage
Main token generation function. Args: model: no interleaving is supported. tokens: prompt tokens extended to be of size [b, max-s
pretrain/megatron/inference/text_generation/generation.py:90
↓ 1 callers
Function
get_added_code_paths
Get paths to all saved encodings. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: Paths of all
pretrain/megatron/core/datasets/retro/index/utils.py:117
↓ 1 callers
Method
get_all_timers_string
Returns the output string with logged timer values according to configured options. Args: names (List[str]): Names of the timers
pretrain/megatron/core/timers.py:304
↓ 1 callers
Function
get_aux_losses_tracker
Return the auxiliary losses.
pretrain/megatron/core/transformer/moe/moe_utils.py:181
↓ 1 callers
Function
get_batch
Generate a batch.
pretrain/pretrain_gpt.py:93
↓ 1 callers
Function
get_batch_on_this_cp_rank
Slice batch input along sequence dimension into multiple chunks, which are parallelized across GPUs in a context parallel group.
pretrain/megatron/training/utils.py:222
↓ 1 callers
Function
get_batch_on_this_tp_rank
(data_iterator)
pretrain/megatron/training/utils.py:276
↓ 1 callers
Method
get_batch_per_block
(sq, sk, b, np)
pretrain/megatron/legacy/model/fused_softmax.py:210
↓ 1 callers
Method
get_batch_per_block
(sq, sk, b, np)
pretrain/megatron/core/fusions/fused_softmax.py:217
↓ 1 callers
Function
get_bias_dropout_add
(training)
pretrain/megatron/legacy/model/transformer.py:829
↓ 1 callers
Function
get_block_nload
Compute number of blocks to load. This is computed by multiplying the total number of available blocks with the fraction of blocks to load.
pretrain/megatron/core/datasets/retro/index/build.py:53
↓ 1 callers
Function
get_block_samples_mapping
Get samples mapping for a dataset over fixed size blocks. This function also requires a dataset of the titles for the source documents since their
pretrain/megatron/legacy/data/realm_dataset_utils.py:111
↓ 1 callers
Function
get_blocks
Divide range [0, num_samples) to sequence of block ranges. This is a core method within the concept of block processing. The idea is to divid
pretrain/megatron/core/datasets/retro/utils.py:112
↓ 1 callers
Function
get_context_parallel_global_ranks
Get all global ranks of the context parallel group that the caller rank belongs to.
pretrain/megatron/core/parallel_state.py:611
↓ 1 callers
Function
get_current_global_batch_size
()
pretrain/megatron/training/global_vars.py:34
↓ 1 callers
Method
get_current_global_batch_size
(self)
pretrain/megatron/training/microbatches.py:51
↓ 1 callers
Function
get_data_modulo_expert_parallel_group
()
pretrain/megatron/core/parallel_state.py:674
↓ 1 callers
Function
get_data_parallel_rank
Return my rank for the data parallel group.
pretrain/megatron/core/parallel_state.py:938
↓ 1 callers
Function
get_data_parallel_world_size
Return world size for the data parallel group.
pretrain/megatron/core/parallel_state.py:928
↓ 1 callers
Function
get_default_causal_mask
Return the causal upper triangular mask for softmax input.
pretrain/megatron/core/transformer/utils.py:30
↓ 1 callers
Function
get_device
(local_rank=None)
pretrain/megatron/training/dist_signal_handler.py:14
↓ 1 callers
Function
get_expert_model_parallel_group
()
pretrain/megatron/core/parallel_state.py:660
↓ 1 callers
Function
get_expert_model_parallel_rank
Return my rank for the expert parallel group
pretrain/megatron/core/parallel_state.py:990
↓ 1 callers
Function
get_expert_parallel_rng_tracker_name
()
pretrain/megatron/core/tensor_parallel/random.py:65
↓ 1 callers
Function
get_gpt_layer_ammo_spec
Mix the native spec with TENorm. This is essentially the native local spec except for the layernorm implementation is using TENorm from Trans
pretrain/megatron/core/inference/gpt/model_specs.py:15
↓ 1 callers
Function
get_index
Read index from disk. Args: config (RetroPreprocessingConfig): Retro preprocessing config. ondisk (bool): If `ondisk = True`, mem
pretrain/megatron/core/datasets/retro/query/query.py:42
↓ 1 callers
Method
get_index_class
Get an index class, given a type string. Args: index_type (str): One of 'faiss-base' (naive Faiss index wrapper) or 'faiss-par-ad
pretrain/megatron/core/datasets/retro/index/factory.py:17
↓ 1 callers
Function
get_individual_chunk_db
Load individual dataset's chunk DB. Args: project_dir (str): Path to Retro project dir. ds_id (int): Index of dataset within blen
pretrain/megatron/core/datasets/retro/db/utils.py:168
↓ 1 callers
Function
get_individual_doc_offsets
Load individual dataset's document offsets. Args: project_dir (str): Path to Retro project dir. ds_id (int): Index of dataset wit
pretrain/megatron/core/datasets/retro/db/utils.py:196
↓ 1 callers
Method
get_loss_scale
Get current loss scale factor. NOTE: The output should be a CUDA tensor of size 1.
pretrain/megatron/core/optimizer/optimizer.py:142
↓ 1 callers
Method
get_lr
Learning rate decay functions from: https://openreview.net/pdf?id=BJYwwY9ll pg. 4
pretrain/megatron/training/optimizer_param_scheduler.py:79
↓ 1 callers
Function
get_ltor_masks_and_position_ids
Build masks and position id for left to right model.
pretrain/megatron/training/utils.py:162
↓ 1 callers
Method
get_main_grads_for_grad_norm
Get main_grads that should be taken into account to compute the grad norm. Filter parameters based on: - grad should not be
pretrain/megatron/core/optimizer/optimizer.py:99
↓ 1 callers
Function
get_megatron_optimizer
Retrieve the Megatron optimizer for model chunks. We use separate optimizers for expert parameters and non-expert parameters. Args:
pretrain/megatron/core/optimizer/__init__.py:255
↓ 1 callers
Function
get_merged_sampled_dataset
Get sampled dataset (for training the vector index). Args: project_dir (str): Path to Retro project dir. chunk_length (int): GPT
pretrain/megatron/core/datasets/retro/db/utils.py:286
↓ 1 callers
Function
get_merged_train_dataset
Get training dataset (for adding to the vector index). Args: project_dir (str): Path to Retro project dir. chunk_length (int): GP
pretrain/megatron/core/datasets/retro/db/utils.py:308
↓ 1 callers
Function
get_model_provider
(only_query_model=False, only_context_model=False, biencoder_shared_query_context_model=False)
pretrain/megatron/legacy/model/biencoder_model.py:18
↓ 1 callers
Function
get_neighbor_dir
Get directory containing neighbor IDs for a dataset (i.e., train, valid, or test). Args: project_dir (str): Retro project dir. ke
pretrain/megatron/core/datasets/retro/query/utils.py:22
↓ 1 callers
Function
get_one_epoch_dataloader
Specifically one epoch to be used in an indexing job.
pretrain/megatron/legacy/data/biencoder_dataset_utils.py:24
↓ 1 callers
Function
get_open_retrieval_batch
(data_iterator)
pretrain/megatron/legacy/data/orqa_wiki_dataset.py:28
↓ 1 callers
Function
get_open_retrieval_wiki_dataset
()
pretrain/megatron/legacy/data/orqa_wiki_dataset.py:16
↓ 1 callers
Function
get_optim_param_to_id_map
(optim_params_iter: Iterable[torch.nn.Parameter])
pretrain/megatron/core/dist_checkpointing/optimizer.py:26
↓ 1 callers
Function
get_optimizer_param_scheduler
Build the learning rate scheduler.
pretrain/megatron/training/training.py:434
↓ 1 callers
Function
get_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
pretrain/megatron/core/dist_checkpointing/optimizer.py:34
↓ 1 callers
Method
get_parameter_state_fs_bucket_space
Get internal representation of parameter state without any copies and modifications. This is referred to as "fully sharded bucket space" beca
pretrain/megatron/core/optimizer/distrib_optimizer.py:657
↓ 1 callers
Function
get_pos_emb_on_this_cp_rank
(pos_emb, seq_dim)
pretrain/megatron/core/models/common/embeddings/rotary_pos_embedding.py:34
↓ 1 callers
Method
get_query_key_value_tensors
This method needs to be implemented based on whether the derived class is "self-attn" or "cross-attn".
pretrain/megatron/core/transformer/attention.py:238
↓ 1 callers
Function
get_retro_encoder_block_spec
Retro encoder block spec. The retro encoder block consists of one customized Retro encoder layer (layer 1), and all of the following layers a
pretrain/megatron/core/models/retro/encoder_spec.py:102
↓ 1 callers
Function
get_router_linear_layer
(config)
pretrain/megatron/legacy/model/transformer.py:178
↓ 1 callers
Method
get_save_function_and_args
Get function that saves the data to storage along with its arguments. Allows the external caller to apply the save function synchrono
pretrain/megatron/core/dist_checkpointing/strategies/filesystem_async.py:116
↓ 1 callers
Function
get_signal_handler
()
pretrain/megatron/training/global_vars.py:78
↓ 1 callers
Function
get_start_time_from_progress_log
Gets start time of earliest job with same world size. Also returns the number of floating-point operations completed in last saved checkpoint
pretrain/megatron/training/training.py:107
↓ 1 callers
Function
get_student_backbone_and_num_features
(config, pre_process=True, post_process=True)
pretrain/megatron/legacy/model/vision/dino.py:176
↓ 1 callers
Function
get_teacher_backbone_and_num_features
(config, pre_process=True, post_process=True)
pretrain/megatron/legacy/model/vision/dino.py:198
↓ 1 callers
Function
get_train_valid_test_num_samples
Train/valid/test num samples.
pretrain/megatron/training/training.py:1293
↓ 1 callers
Function
get_train_valid_test_split_
Get dataset splits from comma or '/' separated string list.
pretrain/megatron/legacy/data/dataset_utils.py:613
↓ 1 callers
Function
get_training_data_block_paths
Get paths to saved embedding blocks. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: Paths of
pretrain/megatron/core/datasets/retro/index/utils.py:78
↓ 1 callers
Method
get_wd
Weight decay incr functions
pretrain/megatron/training/optimizer_param_scheduler.py:54
↓ 1 callers
Function
get_world_size
()
pretrain/megatron/training/dist_signal_handler.py:6
↓ 1 callers
Method
global_coordinates
(self)
pretrain/megatron/core/dist_checkpointing/mapping.py:84
↓ 1 callers
Method
init_data
(self, device: torch.device, init_fn=torch.empty)
pretrain/megatron/core/dist_checkpointing/mapping.py:183
↓ 1 callers
Function
init_indexed_dataset_infos
Gather meta-info about each indexed dataset. The returned info array allows for easy access to the configuration, and helps remove ambiguity.
pretrain/megatron/core/datasets/retro/db/utils.py:32
↓ 1 callers
Function
init_method_normal
Init method based on N(0, sigma).
pretrain/megatron/core/utils.py:167
↓ 1 callers
Method
init_state_dict_from_bert
Initialize the state from a pretrained BERT model on iteration zero of ICT pretraining
pretrain/megatron/legacy/model/realm_model.py:117
↓ 1 callers
Function
initialize_megatron
Set global variables, initialize distributed, and set autoresume and random seeds. `allow_no_cuda` should not be set unless using megatron for
pretrain/megatron/training/initialize.py:25
← previous
next →
701–800 of 2,110, ranked by callers