forked from EleutherAI/gpt-neox
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
280 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{ | ||
"pipe_parallel_size": 1, | ||
"model_parallel_size": 1, | ||
|
||
"num_layers": 24, | ||
"hidden_size": 2048, | ||
"num_attention_heads": 16, | ||
"seq_length": 2048, | ||
"max_position_embeddings": 2048, | ||
"pos_emb": "rotary", | ||
"rotary_pct": 0.25, | ||
"no_weight_tying": true, | ||
"gpt_j_residual": true, | ||
"output_layer_parallelism": "column", | ||
|
||
|
||
"vision_encoder_args": { | ||
"name": "openclip", | ||
"arch": "ViT-B-32", | ||
"modality": "vision", | ||
"pretrained_data": "laion2b_s34b_b79k", | ||
"cache_dir": '/p/scratch/ccstdl/gupta6/openclip/vitb32.pt', | ||
"freeze_encoder": True, | ||
"add_lora": True, | ||
"pretrained": True, | ||
"encoder_type": "openclip", | ||
"embed_dropout_prob": 0.1, | ||
"use_embed_layernorm": True, | ||
"perceiver_seq_length": 64, | ||
"num_layers_to_unfreeze": 2, | ||
}, | ||
|
||
# "attention_config": [[["flash"], 24]], | ||
|
||
"scaled_upper_triang_masked_softmax_fusion": true, | ||
"bias_gelu_fusion": true, | ||
|
||
"init_method": "small_init", | ||
"output_layer_init_method": "wang_init", | ||
|
||
"optimizer": { | ||
"type": "Adam", | ||
"params": { | ||
"lr": 0.0002, | ||
"betas": [0.9, 0.95], | ||
"eps": 1.0e-8 | ||
} | ||
}, | ||
"min_lr": 0.00002, | ||
|
||
|
||
"lr_param_groups_config": { | ||
"image_encoder.encoder":{ | ||
"decay_style" : "cosine", | ||
"start_lr": 0.0002, | ||
"min_lr": 0.00002, | ||
"warmup_iter": 860, | ||
"end_iter": 4300, | ||
}, | ||
"input_layernorm":{ | ||
"decay_style" : "cosine", | ||
"start_lr": 0.0002, | ||
"min_lr": 0.00002, | ||
"warmup_iter": 860, | ||
"end_iter": 4300, | ||
}, | ||
"attention":{ | ||
"decay_style" : "cosine", | ||
"start_lr": 0.0002, | ||
"min_lr": 0.00002, | ||
"warmup_iter": 860, | ||
"end_iter": 4300, | ||
}, | ||
"post_attention_layernorm":{ | ||
"decay_style" : "cosine", | ||
"start_lr": 0.0002, | ||
"min_lr": 0.00002, | ||
"warmup_iter": 860, | ||
"end_iter": 4300, | ||
}, | ||
"mlp.dense_h_to_4h":{ | ||
"decay_style" : "cosine", | ||
"start_lr": 0.0002, | ||
"min_lr": 0.00002, | ||
"warmup_iter": 860, | ||
"end_iter": 4300, | ||
}, | ||
# "27.":{ | ||
# "decay_style" : "cosine", | ||
# "start_lr": 0.0002, | ||
# "min_lr": 0.00002, | ||
# "warmup_iter": 860, | ||
# "end_iter": 4300, | ||
# }, | ||
}, | ||
|
||
"zero_optimization": { | ||
"stage": 1, | ||
"allgather_partitions": true, | ||
"allgather_bucket_size": 500000000, | ||
"overlap_comm": true, | ||
"reduce_scatter": true, | ||
"reduce_bucket_size": 500000000, | ||
"contiguous_gradients": true, | ||
"cpu_offload": false | ||
}, | ||
|
||
"train_micro_batch_size_per_gpu": 16, | ||
"gradient_accumulation_steps": 1, | ||
"data_impl": "mmap", | ||
|
||
"checkpoint_activations": true, | ||
"checkpoint_num_layers": 1, | ||
"partition_activations": true, | ||
"synchronize_each_layer": true, | ||
|
||
"gradient_clipping": 1.0, | ||
"weight_decay": 0.1, | ||
"hidden_dropout": 0, | ||
"attention_dropout": 0, | ||
|
||
# "fp16": { | ||
# "fp16": true, | ||
# "enabled": true, | ||
# "loss_scale": 0, | ||
# "loss_scale_window": 1000, | ||
# "initial_scale_power": 12, | ||
# "hysteresis": 2, | ||
# "min_loss_scale": 1 | ||
# }, | ||
|
||
"bf16": { | ||
"enabled": true | ||
}, | ||
"precision": "bfloat16", | ||
"fp32_allreduce": true, | ||
|
||
"data_types": { | ||
"grad_accum_dtype": "fp32" | ||
}, | ||
|
||
|
||
"train_iters": 500, | ||
"lr_decay_iters": 500, | ||
"distributed_backend": "nccl", | ||
"lr_decay_style": "cosine", | ||
"warmup": 0.01, | ||
"checkpoint_factor": 100, | ||
"eval_interval": 20, | ||
"eval_iters": 10, | ||
|
||
"log_interval": 10, | ||
"steps_per_print": 10, | ||
"keep_last_n_checkpoints": 4, | ||
"wall_clock_breakdown": true, | ||
|
||
# "launcher": "slurm", | ||
# "deepspeed_slurm": true | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
megatron/data/streaming_dataset/interleaved_text_image/add_special_tokens.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from megatron.tokenizer.tokenizer import build_tokenizer | ||
from argparse import ArgumentParser, Namespace | ||
from megatron.tokenizer.tokenizer import build_tokenizer | ||
|
||
def main(args: Namespace) -> None: | ||
"""Main: create C4/pile streaming dataset. | ||
Args: | ||
args (Namespace): Commandline arguments. | ||
""" | ||
# Write samples | ||
args.rank = 0 | ||
args.model_parallel_size = 1 | ||
args.make_vocab_size_divisible_by = 128 | ||
tokenizer = build_tokenizer(args) | ||
tokenizer.tokenizer.add_special_tokens([f"<|p|>"]) | ||
tokenizer.tokenizer.add_special_tokens([f"<|/p|>"]) | ||
tokenizer.tokenizer.add_special_tokens([f"<|box|>"]) | ||
tokenizer.tokenizer.add_special_tokens([f"<|/box|>"]) | ||
tokenizer.tokenizer.add_special_tokens([f"<|grounding|>"]) | ||
tokenizer.tokenizer.add_special_tokens([f"<|image_start|>"]) | ||
tokenizer.tokenizer.add_special_tokens([f"<|image_end|>"]) | ||
|
||
for i in range(1024): | ||
tokenizer.tokenizer.add_special_tokens([f"<|box_{i}|>"]) | ||
|
||
for i in range(8192): | ||
tokenizer.tokenizer.add_special_tokens([f"<|seed_{i}|>"]) | ||
|
||
tokenizer.tokenizer.save( | ||
"/p/project/ccstdl/gupta6/multimodal/20B_tokenizer_final.json" | ||
) | ||
|
||
|
||
def parse_args() -> Namespace: | ||
"""Parse commandline arguments.""" | ||
parser = ArgumentParser( | ||
description="Add new tokens to the vocabulary of a tokenizer." | ||
) | ||
parser.add_argument("--tokenizer_type", type=str, required=False, default=None) | ||
parser.add_argument("--vocab_file", type=str, required=False, default=None) | ||
parser.add_argument("--merge_file", type=str, required=False, default=None) | ||
|
||
parsed = parser.parse_args() | ||
return parsed | ||
|
||
|
||
if __name__ == "__main__": | ||
main(parse_args()) |
Oops, something went wrong.