forked from pytorch/torchtitan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from YerevaNN/model_loading
Model loading
- Loading branch information
Showing
6 changed files
with
139 additions
and
39 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,31 @@ | ||
import submitit | ||
import datetime | ||
import yaml | ||
import os | ||
|
||
|
||
if __name__ == "__main__": | ||
executor = submitit.AutoExecutor(folder="~/slurm_jobs/titan/job_%j") | ||
executor.update_parameters( | ||
name="titan", timeout_min=15, | ||
gpus_per_node=2, | ||
nodes=1, mem_gb=30, cpus_per_task=10, | ||
slurm_array_parallelism=10 | ||
) | ||
|
||
jobs = [] | ||
with executor.batch(): | ||
for _ in range(1): | ||
function = submitit.helpers.CommandFunction([ | ||
'python3', '-m', 'torch.distributed.run', | ||
'--nproc_per_node', '2', | ||
'--rdzv_backend', 'c10d', | ||
'--rdzv_endpoint', 'localhost:0', | ||
'--local-ranks-filter', '0', | ||
'--role', 'rank', '--tee', '3', | ||
'train.py', '--job.config_file', './train_configs/galactica_125m.toml', | ||
]) | ||
print(' '.join(function.command)) | ||
# subprocess.run(function.command) | ||
job = executor.submit(function) | ||
jobs.append(job) |
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
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
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
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,63 @@ | ||
# torchtitan Config.toml | ||
|
||
[job] | ||
dump_folder = "/nfs/dgx/raid/chem/titan_outputs" | ||
description = "Galactica training" | ||
use_for_integration_test = false | ||
|
||
[profiling] | ||
enable_profiling = true | ||
save_traces_folder = "profile_trace" | ||
profile_freq = 10 | ||
enable_memory_snapshot = false | ||
save_memory_snapshot_folder = "memory_snapshot" | ||
|
||
[metrics] | ||
log_freq = 1 | ||
enable_color_printing = true | ||
enable_tensorboard = true | ||
save_tb_folder = "tb" | ||
|
||
[model] | ||
name = "opt" | ||
flavor = "125M" | ||
norm_type = "layernorm_bias" # layernorm / np_layernorm / rmsnorm / compiled_rmsnorm / fused_rmsnorm | ||
# test tokenizer.model, for debug purpose only | ||
tokenizer_path = "./test/assets/test_tiktoken.model" | ||
|
||
[optimizer] | ||
name = "AdamW" | ||
lr = 8e-4 | ||
|
||
[training] | ||
batch_size = 8 | ||
seq_len = 2048 | ||
warmup_steps = 2 # lr scheduler warm up, normally 20% of the train steps | ||
max_norm = 1.0 # grad norm clipping | ||
steps = 10 | ||
data_parallel_degree = -1 | ||
tensor_parallel_degree = 1 | ||
compile = false | ||
dataset = "c4_test" # supported datasets: c4_test (2K), c4 (177M) | ||
|
||
[experimental] | ||
pipeline_parallel_degree = 1 | ||
enable_async_tensor_parallel = false | ||
|
||
[checkpoint] | ||
enable_checkpoint = true | ||
create_seed_checkpoint = false | ||
load_folder = "facebook/galactica-125m" | ||
save_folder = "yerevann/chemlactica-125m" | ||
interval_type = "steps" | ||
interval = 5 | ||
model_weights_only = false | ||
export_dtype = "float32" | ||
async_mode = "async_with_pinned_mem" # ["disabled", "async", "async_with_pinned_mem"] | ||
|
||
[activation_checkpoint] | ||
mode = 'selective' # ['none', 'selective', 'full'] | ||
selective_ac_option = '2' # 'int' = ac every positive int layer or 'op', ac based on ops policy | ||
|
||
[float8] | ||
enable_float8_linear = false |
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