MCPcopy Create free account

hub / github.com/JinjieNi/MegaDLMs / functions

Functions4,219 in github.com/JinjieNi/MegaDLMs

↓ 274 callersMethodsize
Get the size of the dtype/code in bytes Args: key (Union[int, Type[numpy.number]]): The dtype or code Raises:
megatron/core/datasets/indexed_dataset.py:78
↓ 269 callersFunctionprint_rank_0
If distributed is initialized, print only on rank 0.
megatron/training/utils.py:299
↓ 257 callersFunctionget_args
Return arguments.
megatron/training/global_vars.py:23
↓ 211 callersMethodinitialize_model_parallel
( tensor_model_parallel_size=1, pipeline_model_parallel_size=1, virtual_pipeline_model
tests/unit_tests/test_utilities.py:98
↓ 202 callersMethoddestroy_model_parallel
()
tests/unit_tests/test_utilities.py:87
↓ 195 callersMethoditems
Return generator over underlying items.
megatron/core/optimizer/optimizer.py:923
↓ 195 callersMethodsplit
(self, json_line)
tools/preprocess_data.py:77
↓ 91 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()
megatron/core/datasets/indexed_dataset.py:653
↓ 88 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
megatron/core/utils.py:288
↓ 86 callersMethodstart
Start the timer. Args: barrier (bool, optional): Synchronizes ranks before starting. Defaults to False.
megatron/core/timers.py:99
↓ 77 callersMethodfrom_rank_offsets
Allows to construct the ShardedTensor given offset specified in process ranks. Args: key (str): unique key data (torc
megatron/core/dist_checkpointing/mapping.py:236
↓ 72 callersMethodupdate
Updates internal state in grad scaler based on whether NaNs are seen in grads or not.
megatron/core/optimizer/grad_scaler.py:108
↓ 69 callersFunctionmodel_parallel_cuda_manual_seed
Initialize model parallel cuda seed. This function should be called after the model parallel is initialized. Also, no torch.cuda.manual_seed
megatron/core/tensor_parallel/random.py:201
↓ 68 callersMethodstop
Stop the timer. Args: barrier (bool, optional): Synchronizes ranks before stopping. Defaults to False.
megatron/core/timers.py:112
↓ 66 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
megatron/core/timers.py:361
↓ 64 callersMethodis_initialized
Checks if the internal RNG state has been set wirth set_states().
megatron/core/tensor_parallel/random.py:94
↓ 59 callersMethodwrite
Write timers to a tensorboard writer. Note that we only report maximum time across ranks to tensorboard. Args: names (
megatron/core/timers.py:391
↓ 58 callersFunctionbuild_module
(spec_or_module: Union[ModuleSpec, type], *args, **kwargs)
megatron/core/transformer/spec_utils.py:58
↓ 56 callersMethodapply
(cls, *args, **kwargs)
megatron/core/fusions/fused_bias_gelu.py:51
↓ 55 callersFunction_set_arg
(arg_name, old_arg_name=None, force=False)
megatron/training/checkpointing.py:1045
↓ 53 callersMethodraises
Return a list of information on the exceptions that the function may raise.
tools/retro/config_utils.py:181
↓ 52 callersMethodget
(self, key, model)
tools/checkpoint/schema_base.py:65
↓ 52 callersMethodsharded_state_dict
(self)
tests/unit_tests/dist_checkpointing/test_optimizer.py:52
↓ 51 callersMethodexists
Return whether the IndexedDataset exists on disk at the prefix Args: path_prefix (str): The prefix to the index (.idx) and data (
megatron/core/datasets/indexed_dataset.py:726
↓ 50 callersFunctionsave
Saving entrypoint. Extracts ShardedTensors from the given state dict. Rank 0 saves the "regular" part of the checkpoint to common torch file.
megatron/core/dist_checkpointing/serialization.py:288
↓ 49 callersFunctionis_te_min_version
Check if minimum version of `transformer-engine` is installed.
megatron/core/utils.py:80
↓ 49 callersMethodload
(self, sharded_state_dict, ckpt_dir)
tests/unit_tests/dist_checkpointing/test_fully_parallel.py:50
↓ 49 callersMethodstate_dict
(self, prefix='', keep_vars=False)
megatron/legacy/model/module.py:195
↓ 44 callersMethodload
Load the sharded part of the checkpoint.
megatron/core/dist_checkpointing/strategies/base.py:138
↓ 44 callersFunctionlog_retro_rank_0
Log on rank 0. Args: message (str): Message to log.
megatron/core/datasets/retro/utils.py:29
↓ 42 callersFunctionload
Loading entrypoint. In the steps below, the following verbs refer to corresponding objects: - load = load from checkpoint - extract = ext
megatron/core/dist_checkpointing/serialization.py:56
↓ 40 callersMethodload_state_dict
Customized load.
megatron/legacy/model/t5_model.py:184
↓ 34 callersFunctionget_gpt_layer_with_transformer_engine_spec
Use this spec to use lower-level Transformer Engine modules (required for fp8 training). Args: num_experts (int, optional): Number of ex
megatron/core/models/gpt/gpt_layer_specs.py:54
↓ 34 callersFunctionget_tensor_model_parallel_group
Get the tensor-model-parallel group the caller rank belongs to.
megatron/core/parallel_state.py:1036
↓ 32 callersMethodpad
The PAD token id Raises: NotImplementedError: Non-abstract, optional attribute
megatron/core/datasets/megatron_tokenizer.py:112
↓ 31 callersFunctionget_tokenizer
Return tokenizer.
megatron/training/global_vars.py:29
↓ 30 callersMethodclose
(self)
tests/unit_tests/data/test_bin_reader.py:71
↓ 30 callersFunctionget_timers
Return timers.
megatron/training/global_vars.py:58
↓ 30 callersMethodput
(self)
megatron/inference/text_generation_server.py:18
↓ 30 callersMethodtokenize
(self, *text)
tools/preprocess_data.py:44
↓ 28 callersFunctiondiff
Recursive diff of dicts. Args: x1 (object): left dict x2 (object): right dict prefix (tuple): tracks recursive calls. Use
megatron/core/dist_checkpointing/dict_utils.py:69
↓ 28 callersFunctionget_num_microbatches
Get number of microbatches.
megatron/core/num_microbatches_calculator.py:17
↓ 27 callersMethodfrom_pretrained
Instantiate a PreTrainedBertModel from a pre-trained model file. Download and cache the pre-trained model file if needed.
megatron/training/tokenizer/gpt2_tokenization.py:98
↓ 27 callersMethodget_ranks
Get rank group by input token. Args: token (str): Specify the ranks type that want to get. If we want
megatron/core/parallel_state.py:347
↓ 27 callersMethodread
Read bytes into a numpy array. Args: dtype (Type[numpy.number]): Data-type of the returned array. count (int): Numbe
megatron/core/datasets/indexed_dataset.py:348
↓ 26 callersMethodsave
Save the sharded part of the state dict.
megatron/core/dist_checkpointing/strategies/base.py:196
↓ 26 callersFunctionsave_checkpoint
Save a model, optimizer and optionally dataloader checkpoint. Checkpointing context is used to persist some checkpointing state throughout a
megatron/training/checkpointing.py:315
↓ 25 callersFunctionget_gpt_layer_local_spec
Use this spec for an implementation using only modules in Megatron-Core. Args: num_experts (int, optional): Number of experts. Defaults
megatron/core/models/gpt/gpt_layer_specs.py:144
↓ 24 callersMethodbuild
Builds a ShardedStateDict from the original tensor
megatron/core/dist_checkpointing/mapping.py:635
↓ 24 callersMethodfork
Fork the cuda rng state, perform operations, and exit with the original state.
megatron/core/tensor_parallel/random.py:143
↓ 24 callersFunctionget_tensor_model_parallel_world_size
Return world size for the tensor-model-parallel group.
megatron/core/parallel_state.py:1198
↓ 23 callersMethodadd
Add vectors to index. Args: config (RetroPreprocessingConfig): Retro preprocessing config. text_dataset (GPTToTextDat
megatron/core/datasets/retro/index/index.py:111
↓ 23 callersMethodbackward
No-op
megatron/core/utils.py:213
↓ 23 callersFunctionload_checkpoint
Load a model checkpoint and return the iteration. strict (bool): whether to strictly enforce that the keys in :attr:`state_dict` of the ch
megatron/training/checkpointing.py:1148
↓ 23 callersFunctionmake_viewless_tensor
Entry-point for creating viewless tensors. This method should be used, rather than calling 'MakeViewlessTensor' or '_kernel_make_viewles
megatron/core/utils.py:218
↓ 22 callersFunction_broadcast
(item)
megatron/training/utils.py:388
↓ 22 callersMethodencode
(self, json_line)
tools/preprocess_data.py:87
↓ 21 callersFunctiondivide
Ensure that numerator is divisible by the denominator and return the division value.
megatron/core/utils.py:106
↓ 21 callersFunctionload_plain_tensors
Load checkpoint tensors without any sharding and plain structure. NOTE: common state dict is NOT included. Args: checkpoint_dir (str
megatron/core/dist_checkpointing/serialization.py:246
↓ 20 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 ap
megatron/core/dist_checkpointing/mapping.py:482
↓ 19 callersFunctionget_nccl_options
Set the NCCL process group options. Args: pg_name (str): process group name nccl_comm_cfgs (dict): nccl communicator configuratio
megatron/core/parallel_state.py:126
↓ 19 callersFunctionget_one_logger
Return one logger. It can be None so no need to check if it is initialized.
megatron/training/global_vars.py:47
↓ 19 callersFunctionget_tensor_model_parallel_rank
Return caller's rank for the tensor-model-parallel group.
megatron/core/parallel_state.py:1242
↓ 19 callersFunctionparse_args
Parse all arguments.
megatron/training/arguments.py:28
↓ 19 callersMethodstate_dict
(self, destination=None, prefix='', keep_vars=False)
megatron/core/transformer/module.py:183
↓ 19 callersFunctionunwrap_model
(model, module_instances=ALL_MODULE_WRAPPER_CLASSNAMES)
megatron/training/utils.py:54
↓ 18 callersFunction_compare
(arg_name, old_arg_name=None, default=None)
megatron/training/checkpointing.py:83
↓ 17 callersMethodforward
(self, x)
tests/unit_tests/transformer/test_module.py:23
↓ 17 callersFunctionis_torch_min_version
Check if minimum version of `torch` is installed.
megatron/core/utils.py:94
↓ 17 callersMethodsave
(self, sharded_state_dict, ckpt_dir)
tests/unit_tests/dist_checkpointing/test_fully_parallel.py:36
↓ 16 callersFunction_binarize
args: y_data : [float] 4-d tensor in [batch_size, channels, img_rows, img_cols] threshold : [float] [0.0, 1.0] return 4-d bin
tasks/vision/segmentation/metrics.py:17
↓ 16 callersFunctionget_cuda_rng_tracker
Get cuda rng tracker.
megatron/core/tensor_parallel/random.py:195
↓ 16 callersFunctionget_model
Build the model.
megatron/training/training.py:537
↓ 16 callersFunctionnested_values
Returns iterator over (nested) values of a given dict or list.
megatron/core/dist_checkpointing/dict_utils.py:158
↓ 16 callersMethodtokenize
(self, text)
tasks/orqa/unsupervised/tokenizers.py:146
↓ 15 callersMethodbackward
(ctx, output_grads)
megatron/legacy/model/fused_softmax.py:106
↓ 15 callersFunctiondict_list_map_inplace
Maps dicts and lists *in-place* with a given function.
megatron/core/dist_checkpointing/dict_utils.py:190
↓ 15 callersFunctionget_blend_from_list
Get the megatron.core.datasets.blended_megatron_dataset_config.BlendedMegatronDatasetConfig blend from the blend list Args: blend (Option
megatron/core/datasets/utils.py:49
↓ 15 callersFunctionhas_config_logger_enabled
(config)
megatron/core/config_logger.py:17
↓ 15 callersFunctionlog_config_to_disk
Encodes the input dict (dict_data) using the JSONEncoderWithMcoreTypes and dumps to disk, as specified via path
megatron/core/config_logger.py:79
↓ 15 callersFunctionprint_rank_last
If distributed is initialized, print only on last rank.
megatron/training/utils.py:311
↓ 14 callersFunctioncheck_for_arg
(arg_name, default=None)
tools/checkpoint/loader_legacy.py:89
↓ 14 callersFunctioncore_transformer_config_from_args
(args, config_class=None)
megatron/training/arguments.py:782
↓ 14 callersFunctiongenerator_wrapper
The `RankGenerator` class produces a hyper-rectangle for a given set of tensor, pipeline, data, expert, and context parallelism. If we have an
megatron/core/parallel_state.py:670
↓ 14 callersFunctionget_checkpoint_name
Determine the directory name for this rank's checkpoint.
megatron/training/checkpointing.py:124
↓ 14 callersMethodget_current_global_batch_size
Get current global batch size.
megatron/core/num_microbatches_calculator.py:279
↓ 14 callersFunctionget_forward_backward_func
Retrieves the appropriate forward_backward function given the configuration of parallel_state. Returns a function that will perform all of th
megatron/core/pipeline_parallel/schedules.py:26
↓ 14 callersFunctionget_model_chunk_id
Helper method to get the model chunk ID given the iteration number.
megatron/core/pipeline_parallel/schedules.py:768
↓ 14 callersFunctionget_te_version
Get TE version from __version__; if not available use pip's. Use caching.
megatron/core/utils.py:63
↓ 14 callersFunctionis_last_rank
()
megatron/training/utils.py:307
↓ 14 callersFunctionset_random_seed
Set random seed for reproducability.
megatron/legacy/mpu/tests/commons.py:21
↓ 14 callersFunctionsetup_model_and_optimizer
( seed, tp, pp, initialize_fn=initialize_gpt_model, bf16=True, dist_opt=True )
tests/unit_tests/dist_checkpointing/utils.py:155
↓ 14 callersMethodstep
Performs inference step for decoding
megatron/core/ssm/mamba_mixer.py:406
↓ 13 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None
megatron/legacy/model/vision/mit_backbone.py:14
↓ 13 callersFunction_safe_get_rank
Internal function that safely checks and returns the rank of the caller.
megatron/core/rerun_state_machine.py:1101
↓ 13 callersFunctioncheck_for_arg
(arg_name, default=None)
tools/checkpoint/loader_core.py:125
↓ 13 callersFunctioncheck_for_arg
(arg_name, default=None)
tools/checkpoint/loader_mixtral_hf.py:205
↓ 13 callersFunctioncheck_for_arg
(arg_name, default=None)
tools/checkpoint/loader_llama_mistral.py:481
↓ 13 callersFunctionextract_matching_values
Return matching and nonmatching values. Keeps hierarchy. Args: x (Union[dict, list]) : state dict to process. Top-level argument must be
megatron/core/dist_checkpointing/dict_utils.py:18
↓ 13 callersFunctionget_default_strategy
Retrieves a default strategy for a given action, backend and version.
megatron/core/dist_checkpointing/strategies/base.py:29
next →1–100 of 4,219, ranked by callers