Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/EleutherAI/gpt-neox
/ functions
Functions
652 in github.com/EleutherAI/gpt-neox
⨍
Functions
652
◇
Types & classes
103
↓ 65 callers
Function
print_rank_0
If distributed is initialized print only on rank 0.
megatron/__init__.py:17
↓ 64 callers
Method
size
(self, index)
megatron/data/indexed_dataset.py:204
↓ 63 callers
Method
get
Retrieves 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/data/indexed_dataset.py:522
↓ 25 callers
Function
get_key
Search for a given key in a NeoX yaml. normalizes underscores -> hyphens
tools/convert_to_hf.py:60
↓ 24 callers
Method
update_value
updates a property value if the key already exists Problem: a previously non-existing property can be added to the class instance wi
megatron/neox_arguments/template.py:28
↓ 19 callers
Method
update
(self)
megatron/gradient_noise_scale/gradient_noise_scale.py:201
↓ 17 callers
Function
tb_wandb_log
( key, value, iteration_no, use_wandb, tensorboard_writer=None, all_ranks=False )
megatron/logging.py:360
↓ 17 callers
Method
write
(self, sizes, doc_idx)
megatron/data/indexed_dataset.py:371
↓ 13 callers
Method
exists
(path)
megatron/data/indexed_dataset.py:208
↓ 12 callers
Method
from_pretrained
Instantiate a PreTrainedBertModel from a pre-trained model file. Download and cache the pre-trained model file if needed.
megatron/tokenizer/gpt2_tokenization.py:97
↓ 11 callers
Method
decode
(self, tokens)
megatron/tokenizer/gpt2_tokenization.py:314
↓ 11 callers
Function
get_model_parallel_world_size
Return world size for the model parallel group.
megatron/mpu/initialize.py:193
↓ 11 callers
Function
get_root_directory
()
tests/common.py:97
↓ 10 callers
Function
run_neox_args_load_test
(yaml_files)
tests/neox_args/test_neoxargs_load.py:23
↓ 10 callers
Method
start
Start the timer.
megatron/utils.py:233
↓ 9 callers
Function
get_configs_with_path
(configs)
tests/common.py:105
↓ 9 callers
Function
get_model_parallel_group
Get the model parallel group the caller rank belongs to.
megatron/mpu/initialize.py:169
↓ 8 callers
Function
_initialize_affine_weight_cpu
Initialize affine weight for model parallel. Build the master weight on all processes and scatter the relevant chunk.
megatron/mpu/layers.py:52
↓ 8 callers
Function
_initialize_affine_weight_gpu
Initialize affine weight for model parallel on GPU.
megatron/mpu/layers.py:41
↓ 8 callers
Function
add_to_logging
(name)
megatron/logging.py:131
↓ 8 callers
Function
exists
(x)
megatron/model/utils.py:69
↓ 8 callers
Method
from_ymls
instantiates NeoXArgs while reading values from yml files paths_to_yml_files: list of paths to yml files overwrite_values:
megatron/neox_arguments/arguments.py:165
↓ 8 callers
Function
get_model_parallel_rank
Return my rank for the model parallel group.
megatron/mpu/initialize.py:207
↓ 8 callers
Function
parametrize
Generates a random sample of max_tests length of all possible combinations of values in `params_to_test`. In `params_to_test` you can ei
tests/common.py:301
↓ 8 callers
Method
stop
Stop the timer.
megatron/utils.py:240
↓ 7 callers
Function
data_file_path
(prefix_path)
megatron/data/indexed_dataset.py:121
↓ 7 callers
Method
encode
(self, text)
megatron/tokenizer/gpt2_tokenization.py:311
↓ 7 callers
Method
log
Log a group of timers.
megatron/utils.py:297
↓ 6 callers
Method
__init__
(self, vocab_file)
megatron/tokenizer/tokenizer.py:227
↓ 6 callers
Function
_key
(i)
megatron/optimizers.py:177
↓ 6 callers
Function
divide
Ensure that numerator is divisible by the denominator and return the division value.
megatron/mpu/utils.py:29
↓ 6 callers
Function
get_fp32_allreduce
Get the fp32 allreduce flag
megatron/mpu/initialize.py:289
↓ 6 callers
Function
get_normalized_weights_and_num_samples
( weights: List[float], num_samples: int )
megatron/data/data_utils.py:173
↓ 6 callers
Function
index_file_path
(prefix_path)
megatron/data/indexed_dataset.py:117
↓ 6 callers
Function
is_mp_rank_0
True if mp rank == 0
megatron/utils.py:133
↓ 6 callers
Method
write
(self, data)
megatron/logging.py:47
↓ 5 callers
Method
_check_and_set
Auxiliary function for checking the values in the checkpoint and setting them.
megatron/learning_rates.py:111
↓ 5 callers
Method
consume_deepy_args
entry point for deepy.py configuring and consuming command line arguments. We can use `--wandb_group` / `--wandb_team` to overwrite
megatron/neox_arguments/arguments.py:240
↓ 5 callers
Method
convert_key_value_to_command_line_arg
(k, v)
megatron/neox_arguments/arguments.py:442
↓ 5 callers
Method
get_parent_class_value_dict
takes a sequence of parent classes and returns corresponding values (with defaults set)
megatron/neox_arguments/arguments.py:577
↓ 5 callers
Method
load_state_dict
(self, sd)
megatron/learning_rates.py:126
↓ 5 callers
Function
model_setup
(yaml_list=None, param_dict=None, clear_data=True)
tests/common.py:241
↓ 5 callers
Method
tokenize
(self, text: str)
megatron/tokenizer/tokenizer.py:247
↓ 5 callers
Method
width_mult
(self)
megatron/mpu/layers.py:673
↓ 4 callers
Method
__init__
(self, norm_class, hidden_size, eps)
megatron/model/transformer.py:775
↓ 4 callers
Function
build_tokenizer
Initialize tokenizer.
megatron/tokenizer/tokenizer.py:31
↓ 4 callers
Method
encode
(self, text)
tools/preprocess_data.py:49
↓ 4 callers
Function
get_norm
(neox_args)
megatron/model/norms.py:19
↓ 4 callers
Method
inference_mode
Sets up the model for inference by turning on k/v caching (if specified) and setting `parallel output` of the final layer to false, s
megatron/model/utils.py:109
↓ 4 callers
Function
load_partitions
Returns a list containing all weights in a given layer from a model (across MP partitions)
tools/convert_to_hf.py:42
↓ 4 callers
Function
read_longs
(f, n)
megatron/data/indexed_dataset.py:88
↓ 4 callers
Function
recursive_setattr
Recursively set attributes on a pytorch module or an iterable of modules. If an assert_type is provided, it will assert that the type of the
megatron/model/utils.py:192
↓ 4 callers
Method
reset
Reset timer.
megatron/utils.py:247
↓ 4 callers
Function
rotate_half
(x)
megatron/model/positional_embeddings.py:69
↓ 4 callers
Function
save_checkpoint
Save a model checkpoint.
megatron/checkpointing.py:208
↓ 4 callers
Function
setup_model_and_optimizer
Setup model and optimizer.
megatron/training.py:589
↓ 4 callers
Method
state_dict
(self)
megatron/learning_rates.py:100
↓ 4 callers
Method
update_values
Updates multiple values in self if the keys already exists
megatron/neox_arguments/template.py:46
↓ 4 callers
Function
write_longs
(f, a)
megatron/data/indexed_dataset.py:94
↓ 3 callers
Method
__init__
( self, neox_args, input_size, output_size, bias=True, input_i
megatron/mpu/layers.py:587
↓ 3 callers
Function
_gather
Gather tensors and concatinate along the last dimension.
megatron/mpu/mappings.py:79
↓ 3 callers
Function
_reduce
All-reduce the the input tensor across model parallel group.
megatron/mpu/mappings.py:29
↓ 3 callers
Function
_split
Split the tensor along its last dimension and keep the corresponding slice.
megatron/mpu/mappings.py:51
↓ 3 callers
Method
attention
( self, query_layer, key_layer, value_layer, layer_past, attention_mask )
megatron/model/transformer.py:315
↓ 3 callers
Function
bias_dropout_add
( x: Tensor, bias: Tensor, residual: Optional[Tensor], prob: float, training: bool )
megatron/model/fused_bias_dropout.py:28
↓ 3 callers
Function
build_dataset
(index, name)
megatron/data/data_utils.py:120
↓ 3 callers
Function
build_the_dataset
Build train/valid/test datasets.
megatron/data/data_utils.py:54
↓ 3 callers
Method
build_tokenizer
(self)
megatron/neox_arguments/arguments.py:146
↓ 3 callers
Function
clear_test_dirs
()
tests/common.py:114
↓ 3 callers
Method
configure_distributed_args
Configures distributed training arguments from local variables set by deepspeed launcher.
megatron/neox_arguments/arguments.py:656
↓ 3 callers
Method
consume_neox_args
Deepspeed launcher needs to pass the arguments for `pretrain_gpt2.py` across to all machines. In order not to have any problems with
megatron/neox_arguments/arguments.py:395
↓ 3 callers
Function
convert
convert a NeoX checkpoint to a HF model format. should perform model-parallel merging correctly but only supports features allowed by HF GPT-N
tools/convert_to_hf.py:136
↓ 3 callers
Method
detokenize
(self, token_ids)
megatron/tokenizer/tokenizer.py:253
↓ 3 callers
Method
device
(self)
eval_tasks/eval_adapter.py:123
↓ 3 callers
Method
elapsed
Calculate the elapsed time.
megatron/utils.py:252
↓ 3 callers
Function
evaluate_and_print_results
Helper function to evaluate and dump results on screen.
megatron/training.py:927
↓ 3 callers
Function
forward_model
Runs model.forward(model_inputs) We need to create a wrapper for this function because deepspeed pipe parallel modules operate differently t
megatron/text_generation_utils.py:123
↓ 3 callers
Function
generate_samples_from_prompt
Generates samples from raw text and returns them in a dictionary. neox_args: NeoXArgs. model: a Megatron model text: either a single
megatron/text_generation_utils.py:395
↓ 3 callers
Function
get_batch
Generate batch from context tokens. Attention mask and position ids are created. Returned tensors will be on CUDA. neox_args: NeoXArgs.
megatron/text_generation_utils.py:34
↓ 3 callers
Function
get_data_parallel_group
Get the data parallel group the caller rank belongs to.
megatron/mpu/initialize.py:175
↓ 3 callers
Function
get_files
(pth)
tools/inspect_checkpoints.py:204
↓ 3 callers
Function
get_trainable
(model)
megatron/mup_substitute.py:152
↓ 3 callers
Function
init_wandb
(neox_args)
megatron/utils.py:151
↓ 3 callers
Function
initialize_megatron
Set initialize distributed and set autoresume and random seeds. `allow_no_cuda` should not be set unless using megatron for cpu only data proc
megatron/initialize.py:34
↓ 3 callers
Function
make_data_loader
Build dataloader given an input dataset.
megatron/data/data_utils.py:29
↓ 3 callers
Function
print_split_stats
(name, index)
megatron/data/data_utils.py:107
↓ 3 callers
Function
run_train_test
(yaml_list=None, param_dict=None)
tests/model/test_model_train.py:140
↓ 3 callers
Method
to_sequential
Transforms the PipelineModule to a plain nn.Sequential module :return:
megatron/model/gpt2_model.py:338
↓ 3 callers
Function
train_step
Single training step.
megatron/training.py:670
↓ 3 callers
Method
width_mult
(self)
megatron/mpu/layers.py:488
↓ 3 callers
Function
wrapper
()
tests/model/test_model_train.py:68
↓ 2 callers
Method
__init__
(self, num_heads, mp_size=1, mp_rank=1)
megatron/model/positional_embeddings.py:96
↓ 2 callers
Method
__init__
( self, neox_args, init_method, output_layer_init_method, layer_number
megatron/model/gmlp.py:92
↓ 2 callers
Method
__init__
(self, path)
megatron/data/indexed_dataset.py:138
↓ 2 callers
Method
_batch
extracts samples only pertaining to this worker's batch
megatron/data/samplers.py:159
↓ 2 callers
Method
_do_init
(self, path, skip_warmup)
megatron/data/indexed_dataset.py:478
↓ 2 callers
Function
_get
(name)
megatron/model/init_functions.py:175
↓ 2 callers
Function
_get_batch
Support function for get_batch / get_batch pipe (to avoid code repetition)
megatron/training.py:265
↓ 2 callers
Function
_max_reduce_except_dim
(tensor, dim)
megatron/optimizers.py:205
↓ 2 callers
Method
_set_parallel_output
(self, value)
megatron/model/gpt2_model.py:304
next →
1–100 of 652, ranked by callers