MCPcopy Create free account

hub / github.com/JieShibo/MoLE / functions

Functions2,110 in github.com/JieShibo/MoLE

↓ 200 callersMethodsize
Get the size of the dtype/code in bytes Args: key (Union[int, Type[numpy.number]]): The dtype or code Raises:
pretrain/megatron/core/datasets/indexed_dataset.py:67
↓ 110 callersFunctionget_args
Return arguments.
pretrain/megatron/training/global_vars.py:24
↓ 104 callersFunctionprint_rank_0
If distributed is initialized, print only on rank 0.
pretrain/megatron/training/utils.py:255
↓ 57 callersFunctionlog_single_rank
If torch distributed is initialized, log only on rank Args: logger (logging.Logger): The logger to write the logs args (Tuple[An
pretrain/megatron/core/datasets/utils.py:33
↓ 44 callersFunctionlog_retro_rank_0
Log on rank 0. Args: message (str): Message to log.
pretrain/megatron/core/datasets/retro/utils.py:29
↓ 41 callersMethodstart
Start the timer. Args: barrier (bool, optional): Synchronizes ranks before starting. Defaults to False.
pretrain/megatron/core/timers.py:84
↓ 39 callersMethodstop
Stop the timer. Args: barrier (bool, optional): Synchronizes ranks before stopping. Defaults to False.
pretrain/megatron/core/timers.py:97
↓ 34 callersMethodis_initialized
(self)
pretrain/megatron/core/tensor_parallel/random.py:87
↓ 32 callersMethodload
(self, checkpoint_dir: Path)
pretrain/megatron/core/dist_checkpointing/strategies/base.py:80
↓ 32 callersMethodupdate
Updates internal state in grad scaler based on whether NaNs are seen in grads or not.
pretrain/megatron/core/optimizer/grad_scaler.py:108
↓ 29 callersMethodget
Retrieve a single item from the dataset with the option to only return a portion of the item. get(idx) is the same as [idx] but get()
pretrain/megatron/core/datasets/indexed_dataset.py:512
↓ 28 callersFunction_set_arg
(arg_name, old_arg_name=None, force=False)
pretrain/megatron/training/checkpointing.py:577
↓ 28 callersMethodget
(self)
pretrain/megatron/training/microbatches.py:48
↓ 25 callersMethodlog
logs the timers passed in names to stdout. Example usage is to log average per step value for timer 'foo', this function can be called with
pretrain/megatron/core/timers.py:345
↓ 24 callersFunctionbuild_module
(spec_or_module: Union[ModuleSpec, type], *args, **kwargs)
pretrain/megatron/core/transformer/spec_utils.py:60
↓ 23 callersFunctionget_tensor_model_parallel_group
Get the tensor model parallel group the caller rank belongs to.
pretrain/megatron/core/parallel_state.py:563
↓ 22 callersFunction_broadcast
(item)
pretrain/megatron/training/utils.py:280
↓ 22 callersMethodexists
Return whether the IndexedDataset exists on disk at the prefix Args: path_prefix (str): The prefix to the index (.idx) and data (
pretrain/megatron/core/datasets/indexed_dataset.py:592
↓ 20 callersFunctionget_tensor_model_parallel_world_size
Return world size for the tensor model parallel group.
pretrain/megatron/core/parallel_state.py:711
↓ 18 callersFunctionget_model_chunk_id
Helper method to get the model chunk ID given the iteration number.
pretrain/megatron/core/pipeline_parallel/schedules.py:538
↓ 16 callersMethodsave
(self, common_state_dict: StateDict, checkpoint_dir: Path)
pretrain/megatron/core/dist_checkpointing/strategies/base.py:111
↓ 15 callersMethodadd
Add vectors to index. Args: config (RetroPreprocessingConfig): Retro preprocessing config. text_dataset (GPTToTextDat
pretrain/megatron/core/datasets/retro/index/index.py:112
↓ 15 callersMethodbackward
(ctx, output_grads)
pretrain/megatron/legacy/model/fused_softmax.py:91
↓ 15 callersMethodstate_dict
(self, prefix='', keep_vars=False)
pretrain/megatron/legacy/model/module.py:196
↓ 14 callersFunction_compare
(arg_name, old_arg_name=None, default=None)
pretrain/megatron/training/checkpointing.py:41
↓ 14 callersFunctiondivide
Ensure that numerator is divisible by the denominator and return the division value.
pretrain/megatron/core/utils.py:19
↓ 14 callersMethodfork
Fork the cuda rng state, perform operations, and exit with the original state.
pretrain/megatron/core/tensor_parallel/random.py:135
↓ 14 callersFunctionget_num_microbatches
()
pretrain/megatron/training/global_vars.py:30
↓ 14 callersFunctionset_random_seed
Set random seed for reproducability.
pretrain/megatron/legacy/mpu/tests/commons.py:21
↓ 13 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None
pretrain/megatron/legacy/model/vision/mit_backbone.py:14
↓ 13 callersFunctionget_nccl_options
Set the NCCL process group options. Args: pg_name (str): process group name nccl_comm_cfgs (dict): nccl communicator configuratio
pretrain/megatron/core/parallel_state.py:84
↓ 13 callersFunctionprint_separator
(message)
pretrain/megatron/legacy/mpu/tests/commons.py:63
↓ 12 callersFunctionget_checkpoint_name
Determine the directory name for this rank's checkpoint.
pretrain/megatron/training/checkpointing.py:81
↓ 12 callersFunctionget_tensor_model_parallel_rank
Return my rank for the tensor model parallel group.
pretrain/megatron/core/parallel_state.py:751
↓ 12 callersMethodpad
The PAD token id Raises: NotImplementedError: Non-abstract, optional attribute
pretrain/megatron/core/datasets/megatron_tokenizer.py:99
↓ 11 callersFunctionget_cuda_rng_tracker
Get cuda rng tracker.
pretrain/megatron/core/tensor_parallel/random.py:159
↓ 10 callersFunctiondict_list_map_inplace
Maps dicts and lists *in-place* with a given function.
pretrain/megatron/core/dist_checkpointing/dict_utils.py:176
↓ 10 callersFunctionget_timers
Return timers.
pretrain/megatron/training/global_vars.py:72
↓ 10 callersMethodwrite
Write the index (.idx) file Args: sequence_lengths (List[int]): The length of each sequence sequence_modes (Optional
pretrain/megatron/core/datasets/indexed_dataset.py:150
↓ 9 callersMethod__init__
(self, config)
modeling_mole.py:166
↓ 9 callersMethod__init__
(self, config)
modeling_dense.py:166
↓ 9 callersMethod__init__
(self, config)
modeling_moe.py:166
↓ 9 callersMethod__init__
(self, config)
modeling_mole_rep.py:168
↓ 9 callersMethod_check_and_set
Auxiliary function for checking the values in the checkpoint and setting them.
pretrain/megatron/training/optimizer_param_scheduler.py:156
↓ 9 callersFunction_communicate
Communicate tensors between stages. Used as helper method in other communication methods that are used in megatron/schedules.py. Args:
pretrain/megatron/core/pipeline_parallel/p2p_communication.py:230
↓ 9 callersFunction_ensure_var_is_not_initialized
Make sure the input variable is not None.
pretrain/megatron/training/global_vars.py:234
↓ 9 callersFunctionextract_matching_values
Return matching and nonmatching values. Keeps hierarchy. Args: x (Union[dict, list]) : state dict to process. Top-level argument must be
pretrain/megatron/core/dist_checkpointing/dict_utils.py:15
↓ 9 callersMethodfrom_pretrained
Instantiate a PreTrainedBertModel from a pre-trained model file. Download and cache the pre-trained model file if needed.
pretrain/megatron/training/tokenizer/gpt2_tokenization.py:98
↓ 9 callersFunctionget_linear_layer
Simple linear layer with weight initialization.
pretrain/megatron/legacy/model/utils.py:36
↓ 9 callersFunctionget_pipeline_model_parallel_rank
Return my rank for the pipeline model parallel group.
pretrain/megatron/core/parallel_state.py:759
↓ 9 callersMethodpad
(self)
pretrain/megatron/training/tokenizer/tokenizer.py:152
↓ 9 callersMethodstate_dict
(self, destination=None, prefix='', keep_vars=False)
pretrain/megatron/core/transformer/module.py:178
↓ 9 callersMethodtokenize
(self, text)
pretrain/megatron/training/tokenizer/tokenizer.py:123
↓ 8 callersMethod__init__
(self, drop_prob=0.)
pretrain/megatron/legacy/model/transformer.py:64
↓ 8 callersFunctionforward_step
Forward step for passed-in model. If first stage, input tensor is obtained from data_iterator, otherwise passed-in input_tensor is used.
pretrain/megatron/core/pipeline_parallel/schedules.py:153
↓ 8 callersFunctionget_pipeline_model_parallel_next_rank
Return the global rank that follows the caller in the pipeline
pretrain/megatron/core/parallel_state.py:912
↓ 8 callersFunctionget_pipeline_model_parallel_prev_rank
Return the global rank that preceeds the caller in the pipeline
pretrain/megatron/core/parallel_state.py:920
↓ 8 callersFunctionget_tokenizer
Return tokenizer.
pretrain/megatron/training/global_vars.py:43
↓ 8 callersFunctionis_main_replica
Checks if given `replica_id` is considered as main. "Main" replica is: - integer 0 - or an iterable with all 0 elements It is the a
pretrain/megatron/core/dist_checkpointing/mapping.py:192
↓ 8 callersFunctionprint_datetime
Note that this call will sync across all ranks.
pretrain/megatron/training/training.py:58
↓ 8 callersMethodshared_embedding_or_output_weight
(self)
pretrain/megatron/legacy/model/module.py:40
↓ 7 callersMethodfrom_rank_offsets
Allows to construct the ShardedTensor given offset specified in process ranks. Args: key: unique key data: local tens
pretrain/megatron/core/dist_checkpointing/mapping.py:129
↓ 7 callersFunctionget_language_model
Build language model and return along with the key to save.
pretrain/megatron/legacy/model/language_model.py:51
↓ 7 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
pretrain/megatron/core/transformer/utils.py:58
↓ 7 callersFunctionnested_values
Returns iterator over (nested) values of a given dict or list.
pretrain/megatron/core/dist_checkpointing/dict_utils.py:144
↓ 7 callersMethodshared_embedding_or_output_weight
Function to share the input embeddings and output logit weights.
pretrain/megatron/core/models/T5/t5_model.py:330
↓ 7 callersMethodwrite
Write timers to a tensorboard writer. Note that we only report maximum time across ranks to tensorboard. Args: names (List[str]):
pretrain/megatron/core/timers.py:371
↓ 6 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.)
pretrain/megatron/legacy/model/vision/esvit_swin_backbone.py:26
↓ 6 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.)
pretrain/megatron/legacy/model/vision/swin_backbone.py:20
↓ 6 callersFunction_gather_along_last_dim
Gather tensors and concatinate along the last dimension.
pretrain/megatron/core/tensor_parallel/mappings.py:71
↓ 6 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
pretrain/megatron/core/pipeline_parallel/schedules.py:107
↓ 6 callersFunctionenable_grad_sync
Enable asynchronous grad reductions
pretrain/megatron/core/pipeline_parallel/schedules.py:458
↓ 6 callersMethodget_added_index_path
Get file path to index that has been populated with vectors. Args: config (RetroPreprocessingConfig): Retro preprocessing config.
pretrain/megatron/core/datasets/retro/index/index.py:77
↓ 6 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
pretrain/megatron/core/utils.py:26
↓ 6 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
pretrain/megatron/core/datasets/retro/utils.py:191
↓ 6 callersFunctionget_checkpoint_tracker_filename
Tracker file rescords the latest chckpoint during training to restart from.
pretrain/megatron/training/checkpointing.py:179
↓ 6 callersFunctionget_model_config
(model)
pretrain/megatron/core/utils.py:58
↓ 6 callersMethodget_model_parallel_group
Default returned here, but the distributed optimizer overrides this.
pretrain/megatron/core/optimizer/optimizer.py:120
↓ 6 callersFunctionget_pipeline_model_parallel_world_size
Return world size for the pipeline model parallel group.
pretrain/megatron/core/parallel_state.py:719
↓ 6 callersMethodget_tensor
(self, tensor_shape, dtype, name)
pretrain/megatron/core/utils.py:70
↓ 6 callersFunctionget_tensor_and_expert_parallel_group
()
pretrain/megatron/core/parallel_state.py:667
↓ 6 callersMethodload_state_dict
Load the state dicts of each of the models
pretrain/megatron/legacy/model/biencoder_model.py:162
↓ 6 callersMethodload_state_dict
(self, sd)
pretrain/megatron/training/optimizer_param_scheduler.py:172
↓ 6 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 prepend
pretrain/megatron/core/utils.py:186
↓ 6 callersFunctionprint_rank_last
If distributed is initialized, print only on last rank.
pretrain/megatron/training/utils.py:267
↓ 6 callersFunctionretro_makedir
Make a directory, conditional on not being in validation mode. Args: config (RetroPreprocessingConfig): Retro preprocessing config.
pretrain/megatron/core/datasets/retro/utils.py:38
↓ 6 callersFunctionunwrap_model
(model, module_instances=ALL_MODULE_WRAPPER_CLASSNAMES)
pretrain/megatron/training/utils.py:33
↓ 5 callersMethod__init__
(self, tokenizer_name_or_path, vocab_extra_ids, model_max_length, use_fast, prompt_type=None, **kwargs)
pretrain/megatron/training/tokenizer/tokenizer.py:91
↓ 5 callersMethod_build_megatron_dataset_splits
Build each MidLevelDataset split from a single LowLevelDataset Args: dataset_path (Optional[str]): The path on disk which defines
pretrain/megatron/core/datasets/blended_megatron_dataset_builder.py:195
↓ 5 callersMethod_check_token_candidate
(candidate)
pretrain/megatron/training/tokenizer/tokenizer.py:181
↓ 5 callersFunction_initialize_affine_weight_cpu
Initialize affine weight for model parallel. Build the master weight on all processes and scatter the relevant chunk.
pretrain/megatron/core/tensor_parallel/layers.py:104
↓ 5 callersFunction_initialize_affine_weight_gpu
Initialize affine weight for model parallel on GPU.
pretrain/megatron/core/tensor_parallel/layers.py:87
↓ 5 callersFunction_set_cuda_rng_state
Sets the random number generator state of the current GPU. Argumentss: new_state (torch.ByteTensor): The desired state This function
pretrain/megatron/core/tensor_parallel/random.py:31
↓ 5 callersFunction_zero_grad_group_helper
Zero out the gradient for a group of parameters. Note: copied from torch.optim.optimizer.
pretrain/megatron/core/optimizer/optimizer.py:31
↓ 5 callersFunctionbackward_step
Backward step through passed-in output tensor. If last stage, output_tensor_grad is None, otherwise gradient of loss with respect to stage's
pretrain/megatron/core/pipeline_parallel/schedules.py:237
↓ 5 callersFunctionbert_position_ids
(token_ids)
pretrain/megatron/legacy/model/bert_model.py:36
↓ 5 callersFunctionbias_dropout_add
(x, bias, residual, prob, training)
pretrain/megatron/legacy/model/transformer.py:820
↓ 5 callersFunctionbroadcast_from_last_pipeline_stage
Broadcast a tensor from last pipeline stage to all ranks.
pretrain/megatron/inference/text_generation/communication.py:59
↓ 5 callersFunctionbroadcast_from_last_to_first_pipeline_stage
Broadcast tensor values from last stage into the first stage.
pretrain/megatron/inference/text_generation/communication.py:83
↓ 5 callersFunctioncheck_first_val_step
(first_val_step, forward_only, cond)
pretrain/megatron/core/pipeline_parallel/schedules.py:304
next →1–100 of 2,110, ranked by callers