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
↓ 3 callers
Method
forward
(self, x)
modeling_mole_rep.py:177
↓ 3 callers
Method
forward
(self, x)
pretrain/megatron/core/transformer/custom_layers/transformer_engine.py:152
↓ 3 callers
Function
forward_step_helper
Helper method to run forward step with model split into chunks (run set_virtual_pipeline_model_parallel_rank() before calling forward_
pretrain/megatron/core/pipeline_parallel/schedules.py:568
↓ 3 callers
Function
forward_torch_softmax
(input, mask, scale)
pretrain/megatron/legacy/fused_kernels/tests/test_fused_kernels.py:286
↓ 3 callers
Function
get_all_true_mask
(size, device)
pretrain/megatron/core/models/retro/utils.py:23
↓ 3 callers
Function
get_checkpoint_version
()
pretrain/megatron/training/checkpointing.py:31
↓ 3 callers
Function
get_context_parallel_group
Get the context parallel group the caller rank belongs to.
pretrain/megatron/core/parallel_state.py:604
↓ 3 callers
Function
get_db_dir
Sub-directory for DB data. Args: project_dir (str): Path to Retro project dir. Returns: Path of the DB sub-directory wit
pretrain/megatron/core/datasets/retro/db/utils.py:20
↓ 3 callers
Function
get_default_strategy
Retrieves a default strategy for a given action, backend and version.
pretrain/megatron/core/dist_checkpointing/strategies/base.py:24
↓ 3 callers
Method
get_empty_index
Get empty index (i.e., trained, but unpopulated). Args: config (RetroPreprocessingConfig): Retro preprocessing config. R
pretrain/megatron/core/datasets/retro/index/index.py:66
↓ 3 callers
Function
get_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
pretrain/megatron/core/datasets/indexed_dataset.py:698
↓ 3 callers
Function
get_indexed_dataset_infos
Load indexed dataset meta-infos. Args: project_dir (str): Path to Retro project dir. Returns: List of metadata for each data
pretrain/megatron/core/datasets/retro/db/utils.py:121
↓ 3 callers
Function
get_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
pretrain/megatron/core/datasets/retro/db/utils.py:68
↓ 3 callers
Function
get_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
pretrain/megatron/core/datasets/retro/db/utils.py:155
↓ 3 callers
Function
get_linear_layer
Simple linear layer with weight initialization.
pretrain/megatron/core/transformer/utils.py:19
↓ 3 callers
Function
get_merged_dataset
Get merged dataset. Args: project_dir (str): Path to Retro project dir. chunk_length (int): GPT chunk length (e.g., 64).
pretrain/megatron/core/datasets/retro/db/utils.py:245
↓ 3 callers
Function
get_one_logger
Return one logger. It can be None so no need to check if it is initialized.
pretrain/megatron/training/global_vars.py:61
↓ 3 callers
Method
get_parameter_state_dp_zero
Get parameter state (i.e., parameter & optimizer tensors). This method performs two steps: - For each DP rank, copy param & optimizer
pretrain/megatron/core/optimizer/distrib_optimizer.py:697
↓ 3 callers
Method
get_parameters
Get list of parameters wrapped in optimizer.
pretrain/megatron/core/optimizer/optimizer.py:89
↓ 3 callers
Method
get_states
Get rng states. Copy the dictionary so we have direct pointers to the states, not just a pointer to the dictionary.
pretrain/megatron/core/tensor_parallel/random.py:102
↓ 3 callers
Function
get_training_data_block_dir
Get directory for of saved embedding blocks. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: P
pretrain/megatron/core/datasets/retro/index/utils.py:66
↓ 3 callers
Function
get_training_data_merged_path
Get path to merged training embeddings. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: Path t
pretrain/megatron/core/datasets/retro/index/utils.py:90
↓ 3 callers
Function
get_training_data_root_dir
Get root directory for embeddings (blocks and merged data). Args: config (RetroPreprocessingConfig): Retro preprocessing config. Ret
pretrain/megatron/core/datasets/retro/index/utils.py:54
↓ 3 callers
Function
get_virtual_pipeline_model_parallel_rank
Return the virtual pipeline-parallel rank.
pretrain/megatron/core/parallel_state.py:858
↓ 3 callers
Function
get_wandb_writer
Return tensorboard writer. It can be None so no need to check if it is initialized.
pretrain/megatron/training/global_vars.py:55
↓ 3 callers
Function
import_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
pretrain/megatron/core/transformer/spec_utils.py:32
↓ 3 callers
Method
initialize_word_embeddings
(self)
pretrain/megatron/legacy/model/module.py:50
↓ 3 callers
Function
isPerfectSquare
(x)
pretrain/megatron/legacy/model/vision/vit_backbone.py:50
↓ 3 callers
Method
load_parameter_state_from_dp_zero
Load parameter state (i.e., parameter & optimizer tensors) from DP 0 rank. This method performs the reverse of get_parameter_state_dp_zero():
pretrain/megatron/core/optimizer/distrib_optimizer.py:1003
↓ 3 callers
Method
load_state_dict
Customized load.
pretrain/megatron/legacy/model/t5_model.py:175
↓ 3 callers
Method
load_state_dict
(self, state_dict)
pretrain/megatron/core/optimizer/optimizer.py:690
↓ 3 callers
Function
load_zarr_based_sharded_metadata
Load metadata of Zarr arrays. Args: checkpoint_dir (str): checkpoint root directory get_shape_dtype_fn (str -> ((int, ...), np.dt
pretrain/megatron/core/dist_checkpointing/strategies/zarr.py:268
↓ 3 callers
Function
merge
Merges dicts and lists recursively.
pretrain/megatron/core/dist_checkpointing/dict_utils.py:198
↓ 3 callers
Function
merge_dbs
Merge individual DBs into single DB. Args: project_dir (str): Retro project dir. indexed_dataset_infos (List[Dict]): Preprocessin
pretrain/megatron/core/datasets/retro/db/build.py:453
↓ 3 callers
Function
normalize
Do non-exponentiated normalization Args: weights (List[float]): The weights Returns: List[float]: The normalized weights
pretrain/megatron/core/datasets/utils.py:52
↓ 3 callers
Function
open_ts_array
Opens a Zarr file array with Tensorstore with basic setting. Args: arr_path (Path): path to a Zarr (Tensorstore) array
pretrain/megatron/core/dist_checkpointing/strategies/tensorstore.py:111
↓ 3 callers
Function
parallel_lm_logits
LM logits using word embedding weights.
pretrain/megatron/legacy/model/language_model.py:20
↓ 3 callers
Function
parse_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
pretrain/megatron/core/datasets/blended_megatron_dataset_config.py:83
↓ 3 callers
Function
print_split_stats
(name, index)
pretrain/megatron/legacy/data/dataset_utils.py:486
↓ 3 callers
Function
recv_forward
(tensor_shapes, config)
pretrain/megatron/core/pipeline_parallel/schedules.py:1022
↓ 3 callers
Method
reload_model_params
(self)
pretrain/megatron/core/optimizer/optimizer.py:684
↓ 3 callers
Method
reset
Reset timer.
pretrain/megatron/core/timers.py:112
↓ 3 callers
Method
reset
Reset metadata in bucket in preparation for the next iteration of training.
pretrain/megatron/core/distributed/param_and_grad_buffer.py:95
↓ 3 callers
Function
resize
(input, size=None, scale_factor=None, mode='nearest', align_corner
pretrain/megatron/legacy/model/vision/utils.py:6
↓ 3 callers
Function
save_checkpoint
Save a model checkpoint.
pretrain/megatron/training/checkpointing.py:268
↓ 3 callers
Function
scaled_init_method_normal
Init method based on N(0, sigma/sqrt(2*num_layers).
pretrain/megatron/legacy/model/utils.py:21
↓ 3 callers
Function
set_tensor_model_parallel_attributes
(tensor, is_parallel, dim, stride)
pretrain/megatron/core/tensor_parallel/layers.py:59
↓ 3 callers
Method
setup_embeddings_and_output_layer
Sets up embedding layer in first stage and output layer in last stage. This function initalizes word embeddings in the final stage when we ar
pretrain/megatron/core/models/common/language_module/language_module.py:42
↓ 3 callers
Function
sharded_tensor_chunk_id
(sharded_tensor: ShardedTensor)
pretrain/megatron/core/dist_checkpointing/strategies/two_stage.py:61
↓ 3 callers
Method
start_grad_sync
Initiates grad sync (all-reduce or reduce-scatter) communication operation for this bucket. When overlap_grad_reduce is set
pretrain/megatron/core/distributed/param_and_grad_buffer.py:103
↓ 3 callers
Method
state_dict
(self)
pretrain/megatron/core/optimizer/optimizer.py:687
↓ 3 callers
Method
state_dict
The state dict contains all non-DP-rank-dependent (i.e., non-parameter- related) optimizer variables. The returned state dict can be
pretrain/megatron/core/optimizer/distrib_optimizer.py:530
↓ 3 callers
Method
vocab_size
(self)
pretrain/megatron/training/tokenizer/tokenizer.py:108
↓ 3 callers
Function
whitespace_tokenize
Runs basic whitespace cleaning and splitting on a piece of text.
pretrain/megatron/training/tokenizer/bert_tokenization.py:152
↓ 3 callers
Method
without_data
(self)
pretrain/megatron/core/dist_checkpointing/mapping.py:125
↓ 2 callers
Method
__enter__
Enter the context introduced by the 'with' keyword Returns: _IndexWriter: The instance
pretrain/megatron/core/datasets/indexed_dataset.py:115
↓ 2 callers
Method
__enter__
(self)
pretrain/megatron/training/dist_signal_handler.py:60
↓ 2 callers
Method
__exit__
Exit the context introduced by the 'with' keyword Args: exc_type (Optional[Type[BaseException]]): Exception type exc
pretrain/megatron/core/datasets/indexed_dataset.py:130
↓ 2 callers
Method
__init__
(self, hidden_size, init_method)
pretrain/megatron/legacy/model/language_model.py:96
↓ 2 callers
Method
__init__
(self, input_dim=2048, embed_dim=768)
pretrain/megatron/legacy/model/vision/inpainting.py:74
↓ 2 callers
Method
__init__
( self, input_size: int, output_size: int, *, config: ModelParallelCon
pretrain/megatron/core/tensor_parallel/layers.py:866
↓ 2 callers
Method
__init__
( self, config: TransformerConfig, submodules: Union[SelfAttentionSubmodules, CrossAtt
pretrain/megatron/core/transformer/attention.py:56
↓ 2 callers
Method
__init__
Initialize the MoE Token Dispatcher.
pretrain/megatron/core/transformer/moe/token_dispatcher.py:19
↓ 2 callers
Method
__init__
( self, optimizer: torch.optim.Optimizer, config: OptimizerConfig, init_state_fn: Callable, )
pretrain/megatron/core/optimizer/optimizer.py:615
↓ 2 callers
Method
_allocate_memory
(self, inference_max_sequence_len, batch_size, num_attention_heads)
pretrain/megatron/legacy/model/transformer.py:627
↓ 2 callers
Method
_allocate_memory
Allocate memory to store kv cache during inference.
pretrain/megatron/core/transformer/attention.py:153
↓ 2 callers
Function
_allocate_recv_buffer
Receive happens between the layers with size [s, b, h].
pretrain/megatron/inference/text_generation/forward_step.py:72
↓ 2 callers
Method
_build_sample_index
( self, sequence_length: int, min_sentences_per_sample: int )
pretrain/megatron/core/datasets/masked_dataset.py:143
↓ 2 callers
Function
_build_shuffle_index
Build the range [0, size) and shuffle Args: num_samples (int): The size of the first shuffle range [0, num_samples) total_si
pretrain/megatron/core/datasets/gpt_dataset.py:613
↓ 2 callers
Function
_build_tokenizer
Initialize tokenizer.
pretrain/megatron/training/global_vars.py:126
↓ 2 callers
Method
_create_masked_lm_predictions
Creates the predictions for the masked LM objective Args: token_ids (List[int]): The token ids target_sequence_length
pretrain/megatron/core/datasets/masked_dataset.py:224
↓ 2 callers
Method
_finish_param_sync_helper
Waits on all_gather_handle if necessary, then dispatches the next all-gather as necessary.
pretrain/megatron/core/optimizer/distrib_optimizer.py:1289
↓ 2 callers
Function
_forward_step_helper
Single forward step. Update the allocate memory flag so only the first time the memory is allocated.
pretrain/megatron/inference/text_generation/forward_step.py:84
↓ 2 callers
Method
_get_elapsed_time_all_ranks
Returns elapsed times of timers in names. Assumptions: - All the ranks call this function. - `names` are identical on
pretrain/megatron/core/timers.py:200
↓ 2 callers
Function
_get_field
(string, type)
pretrain/megatron/training/training.py:125
↓ 2 callers
Method
_get_global_min_max_time
Report only min and max times across all ranks.
pretrain/megatron/core/timers.py:247
↓ 2 callers
Method
_get_layer
(self, layer_number)
pretrain/megatron/legacy/model/transformer.py:1596
↓ 2 callers
Method
_get_layer_offset
(self)
pretrain/megatron/core/transformer/transformer_layer.py:139
↓ 2 callers
Function
_get_ltor_masks_and_position_ids
Build masks and position id for left to right model. Args: data (torch.Tensor): The data tenor that holds the tokens from the dataset
pretrain/megatron/core/datasets/gpt_dataset.py:643
↓ 2 callers
Function
_get_megatron_optimizer_based_on_param_groups
Get Megatron optimizer based on parameter groups. Args: config (OptimizerConfig): optimizer configuration object. param_groups (l
pretrain/megatron/core/optimizer/__init__.py:151
↓ 2 callers
Function
_get_mlp_module_spec
( use_te: bool = True, num_experts: int = None, moe_grouped_gemm: bool = False )
pretrain/megatron/core/models/gpt/gpt_layer_specs.py:87
↓ 2 callers
Method
_get_model_and_main_params_data_float16
(self)
pretrain/megatron/core/optimizer/optimizer.py:486
↓ 2 callers
Function
_get_prefixes_weights_and_sizes_for_blend
Determine the contribution of the MegatronDataset splits to the BlendedDataset splits Args: blend (List[str]): e.g. ["30", "path/to/d
pretrain/megatron/core/datasets/blended_megatron_dataset_builder.py:304
↓ 2 callers
Function
_is_cuda
Check if a tensor is not none and is cuda.
pretrain/megatron/inference/text_generation/communication.py:45
↓ 2 callers
Function
_kernel_make_viewless_tensor
Make a viewless tensor. View tensors have the undesirable side-affect of retaining a reference to the originally-viewed tensor, even after ma
pretrain/megatron/core/utils.py:83
↓ 2 callers
Function
_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
pretrain/megatron/core/optimizer/optimizer.py:48
↓ 2 callers
Function
_open_zarr_array_verbose
(path: Path, mode: str, **open_kwargs)
pretrain/megatron/core/dist_checkpointing/strategies/zarr.py:191
↓ 2 callers
Function
_process_memory
Get memory used by current process. Returns (int): memory used by current process
pretrain/megatron/core/dist_checkpointing/strategies/filesystem_async.py:280
↓ 2 callers
Method
_query_document_sample_shuffle_indices
Get the text (token ids) and document ids for a given index Args: idx (int): The index into the dataset Returns:
pretrain/megatron/core/datasets/gpt_dataset.py:295
↓ 2 callers
Function
_replace_state_dict_keys_with_sharded_keys
Group ShardedBase objects by keys and return mappings required for recreating the original dict.
pretrain/megatron/core/dist_checkpointing/strategies/torch.py:266
↓ 2 callers
Method
_reset_metadata_and_sync_gather_all_model_params
Reset metadata needed to track results of all-gathers.
pretrain/megatron/core/optimizer/distrib_optimizer.py:1418
↓ 2 callers
Method
_set_bucket
Helper function to create new bucket, add it to list of buckets, and also update param->bucket mapping.
pretrain/megatron/core/distributed/param_and_grad_buffer.py:433
↓ 2 callers
Function
_should_create_array
(ten: ShardedTensor)
pretrain/megatron/core/dist_checkpointing/strategies/zarr.py:101
↓ 2 callers
Function
_verify_checkpoint_and_load_strategy
Verifies if checkpoint metadata exists and matches given strategy. Args: checkpoint_dir (str): checkpoint directory sharded_stra
pretrain/megatron/core/dist_checkpointing/serialization.py:141
↓ 2 callers
Method
add
Add a new hypothesis to the list.
pretrain/megatron/inference/text_generation/beam_utils.py:36
↓ 2 callers
Function
all_to_all
(group, input_, output_split_sizes_=None, input_split_sizes_=None)
pretrain/megatron/core/tensor_parallel/mappings.py:475
↓ 2 callers
Function
append_to_progress_log
(string)
pretrain/megatron/training/training.py:93
↓ 2 callers
Function
apply_factories
Turn ShardedTensorFactories into ShardedTensors *in-place*. Args: sharded_state_dict (ShardedStateDict): state dict possibly containing
pretrain/megatron/core/dist_checkpointing/mapping.py:292
↓ 2 callers
Function
apply_rotary_pos_emb_bshd
Apply rotary positional embedding to input tensor T. check https://kexue.fm/archives/8265 for detailed formulas Args: t (Tensor): In
pretrain/megatron/core/models/common/embeddings/rotary_pos_embedding.py:173
↓ 2 callers
Method
backward
(ctx, output_grads)
pretrain/megatron/core/fusions/fused_softmax.py:88
← previous
next →
201–300 of 2,110, ranked by callers