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
is_done
If there are enough hypotheses and that none of the hypotheses being generated can become better than the worst one in the heap, then
pretrain/megatron/inference/text_generation/beam_utils.py:50
↓ 1 callers
Function
is_initialized
Useful for code segments that may be accessed with or without mpu initialization
pretrain/megatron/core/parallel_state.py:529
↓ 1 callers
Method
is_kernel_available
(self, mask, b, np, sq, sk)
pretrain/megatron/legacy/model/fused_softmax.py:152
↓ 1 callers
Method
is_kernel_available
(self, mask, b, np, sq, sk)
pretrain/megatron/core/fusions/fused_softmax.py:150
↓ 1 callers
Function
is_pipeline_first_stage
Return True if in the first pipeline model-parallel stage, False otherwise.
pretrain/megatron/core/parallel_state.py:773
↓ 1 callers
Function
is_pipeline_last_stage
Return True if in the last pipeline model-parallel stage, False otherwise.
pretrain/megatron/core/parallel_state.py:784
↓ 1 callers
Function
is_pipeline_stage_after_split
Return True if pipeline stage executes decoder block for a model with both encoder and decoder.
pretrain/megatron/core/parallel_state.py:835
↓ 1 callers
Function
is_pipeline_stage_before_split
Return True if pipeline stage executes encoder block for a model with both encoder and decoder.
pretrain/megatron/core/parallel_state.py:820
↓ 1 callers
Function
is_valid_file
(x: str)
pretrain/megatron/legacy/data/image_folder.py:93
↓ 1 callers
Function
load
(args)
pretrain/megatron/legacy/fused_kernels/__init__.py:17
↓ 1 callers
Function
load
Loading entrypoint. In the steps below, the following verbs refer to corresponding objects: - load = load from checkpoint - extract = ext
pretrain/megatron/core/dist_checkpointing/serialization.py:60
↓ 1 callers
Function
load_args_from_checkpoint
Set required arguments from the checkpoint specified in the arguments. Will overwrite arguments that have a non-None default value, but w
pretrain/megatron/training/checkpointing.py:533
↓ 1 callers
Method
load_attributes
Load the necessary attributes: model, dataloader and empty BlockData
pretrain/megatron/legacy/indexer.py:42
↓ 1 callers
Function
load_biencoder_checkpoint
selectively load retrieval models for indexing/retrieving from saved checkpoints
pretrain/megatron/training/checkpointing.py:811
↓ 1 callers
Function
load_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
pretrain/megatron/training/checkpointing.py:626
↓ 1 callers
Function
load_common_state_dict
Load common (non-sharded) objects state dict from the checkpoint. Args: checkpoint_dir (Path): checkpoint directory Returns:
pretrain/megatron/core/dist_checkpointing/serialization.py:173
↓ 1 callers
Method
load_doc_tuples
Load the dataset & document ids. Load the dataset id & document id of each chunk in the database, to be used for causality filtering
pretrain/megatron/core/datasets/retro/db/dataset.py:93
↓ 1 callers
Method
load_parameter_state
Load the distributed parameter states of all optimizers from a file. Args: filename (str): path to load parameter state from.
pretrain/megatron/core/optimizer/optimizer.py:820
↓ 1 callers
Method
load_parameter_state_from_fs_bucket_space
Loads the parameter state from an internal representation. Inverse of the `get_parameter_state_internal_repr` method.
pretrain/megatron/core/optimizer/distrib_optimizer.py:964
↓ 1 callers
Function
load_retro_args
Load predefined args from Retro config (if applicable). When using Retro (or GPT for comparison purposes), data arguments are overridden by t
pretrain/megatron/training/arguments.py:85
↓ 1 callers
Function
load_retro_config
Load Retro's config.json.
pretrain/megatron/training/arguments.py:70
↓ 1 callers
Function
load_sharded_objects
Replaces all ShardedObject from a given state dict with values loaded from the checkpoint. Args: sharded_state_dict (ShardedStateDict):
pretrain/megatron/core/dist_checkpointing/serialization.py:192
↓ 1 callers
Method
load_state_dict
Customized load.
pretrain/megatron/legacy/model/bert_model.py:243
↓ 1 callers
Method
load_state_dict
Copies parameters and buffers from state_dict into the wrapped module and its descendants. If strict is True, then the keys of state_
pretrain/megatron/core/distributed/distributed_data_parallel.py:292
↓ 1 callers
Method
load_state_dict
Load the state dict. As detailed in state_dict(), the state dict contains all non- parameter-related variables. This method is notabl
pretrain/megatron/core/optimizer/distrib_optimizer.py:554
↓ 1 callers
Method
load_tensor_from_storage
(self, checkpoint_dir, ten_meta: _ShardedTensorMetadata)
pretrain/megatron/core/dist_checkpointing/strategies/two_stage.py:129
↓ 1 callers
Function
load_tensors_metadata
Load tensors metadata from the checkpoint. Returns a dictionary similar to a sharded state dict, but note that the dictionary keys are simply
pretrain/megatron/core/dist_checkpointing/serialization.py:228
↓ 1 callers
Method
load_tensors_metadata
Load tensors metadata from the checkpoint. Returns a dictionary similar to a sharded state dict, but note that the dictionary keys ar
pretrain/megatron/core/dist_checkpointing/strategies/base.py:92
↓ 1 callers
Function
load_vocab
Loads a vocabulary file into a dictionary.
pretrain/megatron/training/tokenizer/bert_tokenization.py:121
↓ 1 callers
Function
load_yaml
(yaml_path)
pretrain/megatron/training/yaml_arguments.py:447
↓ 1 callers
Method
local_coordinates
(self)
pretrain/megatron/core/dist_checkpointing/mapping.py:102
↓ 1 callers
Function
make_attention_mask
Returns a 2-dimensional (2-D) attention mask :param source_block: 1-D array :param target_block: 1-D array
pretrain/megatron/legacy/data/biencoder_dataset_utils.py:13
↓ 1 callers
Function
make_dataset
Generates a list of samples of a form (path_to_sample, class). Args: directory (str): root dataset directory class_to_idx (Dict[st
pretrain/megatron/legacy/data/image_folder.py:64
↓ 1 callers
Method
make_dataset
( directory: str, class_to_idx: Dict[str, int], data_per_class_fraction: float,
pretrain/megatron/legacy/data/image_folder.py:178
↓ 1 callers
Function
make_sharded_object_for_checkpoint
Helper for instantiating a non-sharded ShardedObject (replicated across TP and DP group). Args: obj (object): any object to be sharded
pretrain/megatron/core/transformer/utils.py:111
↓ 1 callers
Function
make_sharded_tensor_for_checkpoint
Helper for instantiating a non-sharded ShardedTensor (replicated across TP and DP group). Optionally, can provide offsets which prepend new dime
pretrain/megatron/core/utils.py:214
↓ 1 callers
Method
max_allowed_chunks
(self)
pretrain/megatron/core/dist_checkpointing/mapping.py:114
↓ 1 callers
Function
maybe_copy
(attribute)
pretrain/megatron/core/tensor_parallel/layers.py:79
↓ 1 callers
Method
maybe_init_gloo_group
(self)
pretrain/megatron/core/dist_checkpointing/strategies/two_stage.py:141
↓ 1 callers
Function
maybe_set
(attribute, value)
pretrain/megatron/core/tensor_parallel/layers.py:70
↓ 1 callers
Function
merge_embedding_blocks
Merge individual embedding blocks into a single binary mmap file. The embeddings are initially stored in block-sized (e.g., ~100k embeddings per
pretrain/megatron/core/datasets/retro/index/build.py:70
↓ 1 callers
Function
merge_global_slice_with_shape
(global_slice, actual_shape, key)
pretrain/megatron/core/dist_checkpointing/strategies/tensorstore.py:60
↓ 1 callers
Method
merge_shards_and_save
(self)
pretrain/megatron/legacy/data/realm_index.py:86
↓ 1 callers
Function
modify_logits_for_top_k_filtering
Set the logits for none top-k values to -inf.
pretrain/megatron/inference/text_generation/sampling.py:14
↓ 1 callers
Function
modify_logits_for_top_p_filtering
Set the logits for none top-p values to -inf.
pretrain/megatron/inference/text_generation/sampling.py:22
↓ 1 callers
Function
mpu_cross_entropy
(batch_size, seq_length, vocab_size, logits_scale, seed)
pretrain/megatron/legacy/mpu/tests/test_cross_entropy.py:31
↓ 1 callers
Function
num_samples_to_block_ranges
Split a range (length num_samples) into sequence of block ranges of size block_size. Args: config (RetroPreprocessingConfig): Retro p
pretrain/megatron/core/datasets/retro/index/utils.py:34
↓ 1 callers
Method
numel_low_level_dataset
Abstract method implementation For GPT, the underlying IndexedDataset should be split by sequence, as opposed to, say, BERT, which sh
pretrain/megatron/core/datasets/gpt_dataset.py:202
↓ 1 callers
Function
optim_state_to_sharding_state
Turn optimizer state dict to sharded state dict based on model state dict *in-place*. Can be used to add sharding information to most common opt
pretrain/megatron/core/dist_checkpointing/optimizer.py:90
↓ 1 callers
Function
pad_to_expected_shape
(x: torch.Tensor, expected_sharded_ten: ShardedTensor)
pretrain/megatron/core/dist_checkpointing/strategies/zarr.py:236
↓ 1 callers
Function
parse_args
Parse all arguments.
pretrain/megatron/training/arguments.py:20
↓ 1 callers
Function
post_language_model_processing
(lm_output, labels, logit_weights, parallel_output,
pretrain/megatron/legacy/model/gpt_model.py:16
↓ 1 callers
Function
post_language_model_processing
(lm_output, pooled_output, lm_head, binary_head,
pretrain/megatron/legacy/model/bert_model.py:96
↓ 1 callers
Method
prepare_write_data
First stage of async saving. Copy data to CPU and plan the local saving. Args: plan (SavePlan): save plan generated by t
pretrain/megatron/core/dist_checkpointing/strategies/filesystem_async.py:58
↓ 1 callers
Method
preprocess
Preprocess token indices for AlltoAll communication and token permutation. This method computes the number of tokens assigned to each expert
pretrain/megatron/core/transformer/moe/token_dispatcher.py:309
↓ 1 callers
Function
pretrain
Main training program. This function will run the followings in the order provided: 1) initialize Megatron. 2) setup model, optim
pretrain/megatron/training/training.py:152
↓ 1 callers
Method
process_samples_from_single_path
(filename)
pretrain/megatron/legacy/data/orqa_wiki_dataset.py:164
↓ 1 callers
Function
query_block_neighbors
Query neighbors of a dataset block (i.e., range). Args: config (RetroPreprocessingConfig): Retro preprocessing config. db_dataset
pretrain/megatron/core/datasets/retro/query/query.py:225
↓ 1 callers
Function
query_dataset_neighbors
Query neighbors of each chunk within a dataset. Args: config (RetroPreprocessingConfig): Retro preprocessing config. db_dataset (
pretrain/megatron/core/datasets/retro/query/query.py:279
↓ 1 callers
Function
query_embedding_block
Query a block of embeddings. The block is broken into smaller sub-blocks, for easier tracking of progress. Both the raw neighbor IDs and the
pretrain/megatron/core/datasets/retro/query/query.py:160
↓ 1 callers
Function
query_embeddings
Query neighbors of a block of embeddings. Querying includes: - Query index for neighbor chunk IDs. - Filter chunk IDs that have the s
pretrain/megatron/core/datasets/retro/query/query.py:88
↓ 1 callers
Function
recv_backward
(tensor_shapes, config)
pretrain/megatron/core/pipeline_parallel/schedules.py:1032
↓ 1 callers
Function
recv_from_prev_pipeline_rank_
Receive from previous pipeline stage and update the input buffer inplace.
pretrain/megatron/inference/text_generation/communication.py:13
↓ 1 callers
Function
reduce_scatter_to_sequence_parallel_region
(input_)
pretrain/megatron/core/tensor_parallel/mappings.py:455
↓ 1 callers
Method
release
(self)
pretrain/megatron/training/dist_signal_handler.py:75
↓ 1 callers
Method
remove_codes
Remove added codes after adding to index. Args: config (RetroPreprocessingConfig): Retro preprocessing config.
pretrain/megatron/core/datasets/retro/index/indexes/faiss_par_add.py:176
↓ 1 callers
Function
remove_embeddings
Remove embeddings after training. Args: config (RetroPreprocessingConfig): Retro preprocessing config.
pretrain/megatron/core/datasets/retro/index/build.py:169
↓ 1 callers
Function
report_memory
Simple GPU memory report.
pretrain/megatron/training/utils.py:108
↓ 1 callers
Function
report_theoretical_memory
(args, num_microbatches=None, verbose=False)
pretrain/megatron/training/theoretical_memory_usage.py:150
↓ 1 callers
Function
req_file
(filename, folder="megatron/core")
pretrain/setup.py:44
↓ 1 callers
Method
reset_parameters
(self)
pretrain/megatron/legacy/model/fused_layer_norm.py:68
↓ 1 callers
Method
reset_parameters
(self)
pretrain/megatron/core/fusions/fused_layer_norm.py:122
↓ 1 callers
Method
retrieve_write_results
Turn self.write_results into a single results lists. Includes error check. Returns (List[WriteResult]): the list of write results fr
pretrain/megatron/core/dist_checkpointing/strategies/filesystem_async.py:203
↓ 1 callers
Method
retro_decoder_cross_attention
Cross attention for Retro decoder. Notation: ns : Sequence length. bs : Batch size. d : Hidden size.
pretrain/megatron/legacy/model/transformer.py:1037
↓ 1 callers
Method
retro_encoder_cross_attention
Cross attention for Retro encoder. Notation: ns : Sequence length. bs : Batch size. d : Hidden size.
pretrain/megatron/legacy/model/transformer.py:970
↓ 1 callers
Method
routing
Top-k routing function Args: logits (torch.Tensor): Logits tensor. Returns: Tuple[torch.Tensor, torch.Tensor
pretrain/megatron/core/transformer/moe/router.py:221
↓ 1 callers
Method
run
(self, url, port)
pretrain/megatron/inference/text_generation_server.py:240
↓ 1 callers
Method
run_realtime_tests
Performs a consistency check. This function makes sure that tensors across devices are the same during an experiment. This is often n
pretrain/megatron/core/transformer/attention.py:395
↓ 1 callers
Function
sample
Sample and generate a token. Note: logits has the dimension [b, v] where b is the batch size and v is the vocabulary size. If vocab
pretrain/megatron/inference/text_generation/sampling.py:45
↓ 1 callers
Method
save
Translates MCore ShardedTensors to PyT ShardedTensors and saves in PyT Distributed format. Args: sharded_state_dict (ShardedStat
pretrain/megatron/core/dist_checkpointing/strategies/torch.py:399
↓ 1 callers
Method
save_block
Save block of codes to disk. Args: config (RetroPreprocessingConfig): Retro preprocessing config. block (dict): Range
pretrain/megatron/core/datasets/retro/index/indexes/faiss_par_add.py:70
↓ 1 callers
Function
save_block_db
Save block of chunked tokens to disk. These blocks are later used for training and adding to the vector index. Args: block (dict): Ra
pretrain/megatron/core/datasets/retro/db/build.py:252
↓ 1 callers
Function
save_config
Save given config to checkpoint directory. Args: config: checkpoint config checkpoint_dir: checkpoint directory Returns:
pretrain/megatron/core/dist_checkpointing/core.py:65
↓ 1 callers
Function
save_indexed_dataset_infos
Save dataset order & meta-info. Args: project_dir (str): Path to Retro project dir. indexed_dataset_infos (List[Dict]): List of m
pretrain/megatron/core/datasets/retro/db/utils.py:80
↓ 1 callers
Method
save_parameter_state
Save the distributed parameter states of all optimizers to a file. Args: filename (str): path to save parameter state to.
pretrain/megatron/core/optimizer/optimizer.py:795
↓ 1 callers
Method
save_shard
Save the block data that was created this in this process
pretrain/megatron/legacy/data/realm_index.py:74
↓ 1 callers
Function
save_state_dict_async_finalize
Finalization of save_state_dict_async_plan. The input arguments are the same as the save_state_dict_async_plan output, the `write_result
pretrain/megatron/core/dist_checkpointing/strategies/state_dict_saver.py:100
↓ 1 callers
Function
save_state_dict_async_plan
First stage of saving a state dict to storage. This is an async adjustment of torch.distributed.checkpoint.state_dict_saver. In order to
pretrain/megatron/core/dist_checkpointing/strategies/state_dict_saver.py:24
↓ 1 callers
Function
scaled_init_method_normal
Init method based on N(0, sigma/sqrt(2*num_layers).
pretrain/megatron/core/utils.py:176
↓ 1 callers
Function
scatter_to_tensor_model_parallel_region
(input_)
pretrain/megatron/core/tensor_parallel/mappings.py:439
↓ 1 callers
Function
score_and_return_on_first_stage
Function for just scoring. Args: model: no interleaving is supported. tokens: prompt tokens extended to be of size [b, max_prompt
pretrain/megatron/inference/text_generation/generation.py:19
↓ 1 callers
Function
send_backward_recv_forward
(input_tensor_grads, tensor_shapes, config)
pretrain/megatron/core/pipeline_parallel/schedules.py:1075
↓ 1 callers
Method
send_do_beam_search
()
pretrain/megatron/inference/text_generation_server.py:27
↓ 1 callers
Method
send_do_generate
()
pretrain/megatron/inference/text_generation_server.py:22
↓ 1 callers
Function
send_forward_recv_backward
(output_tensors, tensor_shapes, config)
pretrain/megatron/core/pipeline_parallel/schedules.py:1060
↓ 1 callers
Function
send_to_next_pipeline_rank
Send output to the next pipeline stage.
pretrain/megatron/inference/text_generation/communication.py:30
↓ 1 callers
Function
set_args
(args)
pretrain/megatron/training/global_vars.py:111
↓ 1 callers
Function
set_checkpoint_version
(value)
pretrain/megatron/training/checkpointing.py:23
↓ 1 callers
Method
set_epoch
(self, epoch)
pretrain/megatron/legacy/data/data_samplers.py:114
↓ 1 callers
Function
set_global_variables
Set args, tokenizer, tensorboard-writer, adlr-autoresume, and timers.
pretrain/megatron/training/global_vars.py:90
← previous
next →
801–900 of 2,110, ranked by callers