MCPcopy Create free account

hub / github.com/JinjieNi/MegaDLMs / functions

Functions4,219 in github.com/JinjieNi/MegaDLMs

↓ 2 callersMethodcalculate_gradients
Calculates gradients.
megatron/core/tensor_parallel/cross_entropy.py:104
↓ 2 callersMethodcalculate_logits_max
Calculates logits_max.
megatron/core/tensor_parallel/cross_entropy.py:23
↓ 2 callersMethodcalculate_predicted_logits
Calculates predicted logits.
megatron/core/tensor_parallel/cross_entropy.py:35
↓ 2 callersMethodcall_ddp_preforward_hook
Call any DDP pre-forward hooks which are used to launch async data parallel param gather. Any other pre-forward hooks are not allowed.
megatron/core/transformer/cuda_graphs.py:715
↓ 2 callersMethodcan_update_timeouts
Returns True if new timeouts can be computed. `.on_timeouts_updated()` resets this property back to False.
megatron/training/ft_integration.py:60
↓ 2 callersMethodcancel_gradients_last_layer
(self, iteration)
megatron/legacy/model/vision/dino.py:278
↓ 2 callersMethodcheck_backend_compatibility
Verifies if this strategy is compatible with `loaded_backend`.
megatron/core/dist_checkpointing/strategies/base.py:80
↓ 2 callersMethodcheck_version_compatibility
Verifies if this strategy is compatible with `loaded_version`.
megatron/core/dist_checkpointing/strategies/base.py:85
↓ 2 callersFunctionclear_embedding_activation_buffer
Clear embedding activation buffer.
megatron/core/pipeline_parallel/schedules.py:506
↓ 2 callersFunctionclip_grad_by_total_norm_fp32
Clips gradient of an iterable of parameters in fp32 by total norm. Note that the gradients are modified in place. Args: parameters (
megatron/core/optimizer/clip_grads.py:138
↓ 2 callersMethodclip_grad_norm
Compute and return grad norm, also clip grads.
megatron/core/optimizer/optimizer.py:195
↓ 2 callersFunctioncollect_train_test_metrics
(logs_dir, index)
tests/functional_tests/python_test_utils/test_resume_checkpoint_pipeline.py:13
↓ 2 callersFunctioncommon_test_simple_sharded_state_dict_save_load
Simple save and load sanity check, without any equality tests.
tests/unit_tests/dist_checkpointing/models/common.py:22
↓ 2 callersFunctioncommon_test_state_dict_comparison
(initialize_model_fn, tmp_path_dist_ckpt)
tests/unit_tests/dist_checkpointing/models/common.py:137
↓ 2 callersFunctioncommon_test_vocab_size_padding_change
Test model loading with different vocab size (caused by TP padding).
tests/unit_tests/dist_checkpointing/models/common.py:170
↓ 2 callersFunctioncompute_feature_bank
(model)
megatron/legacy/model/vision/knn_monitor.py:38
↓ 2 callersFunctioncompute_ngram_freq_sorted
(args, ngrams)
tools/openwebtext/filter_ngrams.py:272
↓ 2 callersMethodcontrast
Contrast distortion.
tasks/vision/segmentation/transforms.py:67
↓ 2 callersFunctionconversion_helper
Apply conversion to val. Recursively apply conversion if `val` #is a nested tuple/list structure.
megatron/legacy/model/module.py:127
↓ 2 callersFunctionconversion_helper
(val, conversion)
megatron/core/transformer/module.py:104
↓ 2 callersMethodconvert_ids_to_tokens
Converts a sequence of ids in BPE tokens using the vocab.
megatron/training/tokenizer/gpt2_tokenization.py:272
↓ 2 callersFunctionconvert_split_vector_to_split_matrix
Build the split matrix from one or optionally two contributing split vectors. Ex. a standard conversion: [0.99, 0.01, 0.0] -> [(0, 0.99), (0
megatron/core/datasets/blended_megatron_dataset_config.py:135
↓ 2 callersMethodconvert_tokens_to_ids
Converts a sequence of tokens into ids using the vocab.
megatron/training/tokenizer/gpt2_tokenization.py:250
↓ 2 callersMethodconvert_tokens_to_ids
Convert tokens to IDs.
megatron/training/tokenizer/multimodal_tokenizer.py:239
↓ 2 callersFunctioncopy_to_tensor_model_parallel_region
Wrapper for autograd function: forward: copy, backward allreduce
megatron/core/tensor_parallel/mappings.py:467
↓ 2 callersMethodcreate_bwd_graph
Create a bwd cudagraph for this runner. Should be called inside 'create_cudagraphs()'.
megatron/core/transformer/cuda_graphs.py:494
↓ 2 callersMethodcreate_fwd_graph
Create a fwd cudagraph for this runner. Should be called inside 'create_cudagraphs()'.
megatron/core/transformer/cuda_graphs.py:410
↓ 2 callersMethodcreate_local_plan
Adds IOBytes write request on non-coordinator ranks.
megatron/core/dist_checkpointing/strategies/torch.py:472
↓ 2 callersFunctiondecompose
This function solve the math problem below: There is an equation: index = sum(idx[i] * stride[i]) And
megatron/core/parallel_state.py:208
↓ 2 callersFunctiondestroy_global_memory_buffer
Sets the global memory buffer to None
megatron/core/parallel_state.py:1752
↓ 2 callersFunctiondestroy_model_parallel
Set the groups to none.
megatron/core/parallel_state.py:1777
↓ 2 callersFunctiondestroy_rerun_state_machine
Helper function to shut down the rerun machine instance.
megatron/core/rerun_state_machine.py:1077
↓ 2 callersMethoddetokenize
Convert embedding ids to text Args: ids (numpy.ndarray): The ids to convert Returns: str: The converted text
megatron/core/datasets/megatron_tokenizer.py:46
↓ 2 callersFunctiondevice_limited_topk
Perform top-k routing on a subset of expert parallel ranks. Selects N ranks for each token, then conducts top-k selection among experts on these
megatron/core/transformer/moe/moe_utils.py:307
↓ 2 callersMethoddisable_forward_pre_hook
Disable forward pre-hooks needed for param all-gather overlap with forward compute. Skip synchronous param all-gather if `param_sync`
megatron/core/distributed/distributed_data_parallel.py:309
↓ 2 callersFunctiondistribute_main_replicas_with_precomputed_distribution
Applies the save distribution computed with `determine_main_replica_uniform_distribution`. Based on rank assignment, sets replica ids of the shar
megatron/core/dist_checkpointing/strategies/fully_parallel.py:387
↓ 2 callersFunctiondo_test_preprocess_data
(temp_dir, extra_args=[])
tests/unit_tests/data/test_preprocess_data.py:71
↓ 2 callersMethoddtype_from_code
Get the dtype from the code Args: value (int): The code Returns: Type[numpy.number]: The dtype
megatron/core/datasets/indexed_dataset.py:66
↓ 2 callersMethodembed_text
Embed a single text string. Primarily used for on-the-fly embeddings, particularly during analysis or debugging. For large scale, use
tools/bert_embedding/embed.py:205
↓ 2 callersMethodembed_text_dataset_block
Embed a range of a text dataset. Args: embedder (Embedder): Embedder used for embedding a text dataset. text_dataset
megatron/core/datasets/retro/index/index.py:119
↓ 2 callersMethodempty_from_unique_key
Instantiates a ShardedObject from a unique key. Args: unique_key: a string of the form <key>/shard_<global_offset
megatron/core/dist_checkpointing/mapping.py:573
↓ 2 callersMethodencode_block
Encode sub-dataset block, to be later added to index. Encode the data subset, generally in blocks of 1M vectors each. For each block,
megatron/core/datasets/retro/index/indexes/faiss_par_add.py:41
↓ 2 callersMethodend_document
Finalize the document, for use with IndexedDatasetBuilder.add_item
megatron/core/datasets/indexed_dataset.py:800
↓ 2 callersMethodevaluate
(self, qa_data, split)
tasks/orqa/evaluate_utils.py:105
↓ 2 callersFunctionexchange_by_distribution
Exchange tensors loaded by different ranks using the specified exchange_algo. Args: loaded_tensors (Dict[_ShardId, torch.Tensor]): mappin
megatron/core/dist_checkpointing/exchange_utils.py:485
↓ 2 callersFunctionextra_args_provider
difflm arguments.
custom_args/difflm.py:1
↓ 2 callersFunctionextract_sharded_tensors_and_factories
Extract a dict consisting of only ShardedTensor and ShardedTensorFactory objects from a given state dict with any objects. Args: shar
megatron/core/dist_checkpointing/utils.py:72
↓ 2 callersFunctionfind_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
megatron/training/checkpointing.py:171
↓ 2 callersFunctionfinish_embedding_wgrad_compute
Finish embedding wgrad compute.
megatron/core/pipeline_parallel/schedules.py:528
↓ 2 callersMethodfinish_grad_sync
Finishes grad sync (all-reduce or reduce-scatter) communication operations for all model gradients. When overlap_grad_reduce
megatron/core/distributed/data_parallel_base.py:49
↓ 2 callersFunctionflatten_range
Apply flattened range to a tensor.
megatron/core/dist_checkpointing/strategies/zarr.py:256
↓ 2 callersMethodforward
Run a forward pass for each of the models and return the respective embeddings.
megatron/legacy/model/realm_model.py:67
↓ 2 callersMethodforward
(ctx, inputs, scale)
megatron/legacy/model/fused_softmax.py:91
↓ 2 callersMethodforward
(ctx, inputs, scale)
megatron/core/fusions/fused_softmax.py:78
↓ 2 callersMethodforward
Replay the forward graph of the passed runner.
megatron/core/transformer/cuda_graphs.py:254
↓ 2 callersFunctionforward_step
Forward step.
tasks/quantize/calibrate_gpt.py:81
↓ 2 callersFunctionforward_step_func
(data_iterator, model)
tests/unit_tests/pipeline_parallel/test_schedules.py:55
↓ 2 callersMethodforward_with_attention
(self, x)
megatron/legacy/model/vision/esvit_swin_backbone.py:445
↓ 2 callersFunctionfused_apply_rotary_pos_emb_thd
Apply rotary positional embedding to input tensor T in `thd` format with CP support.
megatron/core/extensions/transformer_engine.py:1247
↓ 2 callersMethodgating
Forward pass of the router gate. Args: input (torch.Tensor): Input tensor. Returns: torch.Tensor: Logits ten
megatron/core/transformer/moe/router.py:54
↓ 2 callersFunctiongeglu
(y)
megatron/core/fusions/fused_bias_geglu.py:17
↓ 2 callersFunctiongeglu_back
(g, y)
megatron/core/fusions/fused_bias_geglu.py:32
↓ 2 callersMethodgenerate
model_kwargs: model: Mask predictor. prompt: A tensor of shape (1, L). steps: Sampling steps, less than o
tools/weights_conversion/hf_configs/gpt2_1b_dlm/modeling_dlm.py:796
↓ 2 callersMethodget
Get number of microbatches.
megatron/core/num_microbatches_calculator.py:275
↓ 2 callersFunctionget_adlr_autoresume
ADLR autoresume object. It can be None so no need to check if it is initialized.
megatron/training/global_vars.py:52
↓ 2 callersFunctionget_batch
Generate a batch.
pretrain_difflm.py:221
↓ 2 callersFunctionget_batch
Generate a batch
tools/retro/sft/sft_retro.py:86
↓ 2 callersFunctionget_batch_on_this_tp_rank
(data_iterator)
megatron/training/utils.py:384
↓ 2 callersFunctionget_bias_dropout_add
(training, fused)
megatron/core/fusions/fused_bias_dropout.py:62
↓ 2 callersMethodget_config
(cls)
tests/unit_tests/transformer/test_retro_attention.py:27
↓ 2 callersFunctionget_config_logger_path
(config)
megatron/core/config_logger.py:13
↓ 2 callersMethodget_crop_bbox
Randomly get a crop bounding box.
tasks/vision/segmentation/transforms.py:157
↓ 2 callersFunctionget_current_running_global_batch_size
Get current running global batch size, taking into account number of DP replicas might be incompatible with true global batch size if `decrease_ba
megatron/core/num_microbatches_calculator.py:32
↓ 2 callersMethodget_db_chunk_gpt
Get DB chunk as GPT token ids.
tools/retro/cli/cli.py:115
↓ 2 callersFunctionget_distributed_optimizer_checkpoint_name
(model_checkpoint_name)
megatron/training/checkpointing.py:166
↓ 2 callersMethodget_document_indices
Get the document indices This method is slated for deprecation. Returns: numpy.ndarray: The document indices
megatron/core/datasets/indexed_dataset.py:696
↓ 2 callersFunctionget_empty_index_path
Path of empty index. Args: config (RetroPreprocessingConfig): Retro preprocessing config. Returns: Path to the empty (traine
megatron/core/datasets/retro/index/build.py:39
↓ 2 callersFunctionget_expert_data_parallel_group
Get expert data parallel group.
megatron/core/parallel_state.py:1704
↓ 2 callersMethodget_fp8_context
Return a new fp8 context in cudagraph mode.
megatron/core/transformer/cuda_graphs.py:401
↓ 2 callersMethodget_freqs_non_repeated
Generates matrix of frequencies based on positions in the sequence, used to create positional encodings
megatron/core/models/common/embeddings/rotary_pos_embedding.py:115
↓ 2 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/difflm/gpt_layer_specs.py:239
↓ 2 callersFunctionget_gpt_layer_modelopt_spec
Mix the native spec with TENorm. This is essentially the native local spec except for the layernorm implementation is using TENorm from Trans
megatron/core/inference/modelopt_support/gpt/model_specs.py:15
↓ 2 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/difflm/gpt_layer_specs.py:59
↓ 2 callersFunctionget_grad_norm_fp32
Calculate the norm of gradients in fp32. This is adapted from torch.nn.utils.clip_grad.clip_grad_norm_ and added functionality to handle mode
megatron/core/optimizer/clip_grads.py:51
↓ 2 callersFunctionget_individual_db_dir
Individual DB's directory. Args: project_dir (str): Path to Retro project dir. prefix (str): Unique relative path to dataset with
megatron/core/datasets/retro/db/utils.py:140
↓ 2 callersMethodget_layer
(self, model, layer_idx)
tools/checkpoint/schema_base.py:68
↓ 2 callersMethodget_local_model_weights_per_gpu
Get the trtllm model weights split per gpu Given the trtllm mapping information (tp, pp rank etc) we split the model weights in a list, with
megatron/core/export/trtllm/trtllm_weights_converter/single_device_trtllm_model_weights_converter.py:381
↓ 2 callersMethodget_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
megatron/core/optimizer/optimizer.py:132
↓ 2 callersFunctionget_merged_db_path_map
Paths to merged datasets. Args: project_dir (str): Path to Retro project dir. Returns: A dict of chunk databases, one for ea
megatron/core/datasets/retro/db/utils.py:223
↓ 2 callersMethodget_meta
Get meta from key, which must be either 'src' or 'dst'.
tests/functional_tests/test_cases/common/ckpt_converter/__main__.py:121
↓ 2 callersMethodget_micro_batch_size
Get current global batch size.
megatron/core/num_microbatches_calculator.py:283
↓ 2 callersFunctionget_microbatch_id_in_model_chunk
Helper method to get the microbatch_id within model chunk given the iteration number.
megatron/core/pipeline_parallel/schedules.py:775
↓ 2 callersFunctionget_model
Build the model.
megatron/training/training_nan_skipping.py:529
↓ 2 callersFunctionget_model_and_buffers
( input_dim: int, output_dim: int, num_layers: int, bias: bool, shared_embedding: bool,
tests/unit_tests/distributed/test_param_and_grad_buffer.py:15
↓ 2 callersFunctionget_model_provider
(only_query_model=False, only_context_model=False, biencoder_shared_query_context_model=False)
megatron/legacy/model/biencoder_model.py:19
↓ 2 callersFunctionget_model_schema
( model_type: T.Literal["GPT", "BERT"], transformer_impl: T.Literal["transformer_engine", "local"],
tools/checkpoint/schema_core.py:163
↓ 2 callersFunctionget_models
(count, dtype)
tools/checkpoint/loader_core.py:160
↓ 2 callersFunctionget_models
(count, dtype)
tools/checkpoint/loader_legacy.py:129
↓ 2 callersFunctionget_models
(count, dtype, pre_process, post_process)
tools/checkpoint/saver_legacy.py:200
↓ 2 callersMethodget_modules
(cls, config, use_transformer_engine, use_gpu)
tests/unit_tests/transformer/test_retro_attention.py:40
← previousnext →701–800 of 4,219, ranked by callers