Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions torchtitan/models/deepseek_v3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@
dim=2048,
inter_dim=10944,
moe_inter_dim=1408,
n_layers=27,
# n_layers=27,
n_layers=1,
n_dense_layers=1,
n_heads=16,
# n_heads=16,
# n_heads=1, # n_heads=2 reproduces the nan error
n_heads=2,
n_routed_experts=64,
n_shared_experts=2,
n_activated_experts=6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enable_memory_snapshot = false
save_memory_snapshot_folder = "memory_snapshot"

[metrics]
log_freq = 10
log_freq = 1
disable_color_printing = false
enable_tensorboard = false
save_tb_folder = "tb"
Expand All @@ -37,10 +37,10 @@ decay_type = "cosine"
min_lr_factor = 0.1

[training]
local_batch_size = 8
local_batch_size = 1
seq_len = 4096
max_norm = 1.0 # grad norm clipping
steps = 1000
steps = 2
compile = false
dataset = "c4" # supported datasets: c4_test (2K), c4 (177M)

Expand Down
2 changes: 1 addition & 1 deletion torchtitan/models/llama3/infra/parallelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _apply_ac_to_transformer_block(
)

if ac_config.mode == "full":
return ptd_checkpoint_wrapper(module, preserve_rng_state=False)
return ptd_checkpoint_wrapper(module, preserve_rng_state=False, debug=True)

assert ac_config.mode == "selective", f"{ac_config.mode}"
use_op_sac = ac_config.selective_ac_option == "op"
Expand Down
3 changes: 2 additions & 1 deletion torchtitan/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from typing import Any, Generator, Iterable, Optional

import torch
from torch.distributed.elastic.multiprocessing.errors import record

import torchtitan.protocols.train_spec as train_spec_module
from torch.distributed.elastic.multiprocessing.errors import record
from torchtitan.components.checkpoint import CheckpointManager
from torchtitan.components.dataloader import DataloaderStopIteration
from torchtitan.components.ft import FTManager, maybe_semi_sync_training
Expand Down Expand Up @@ -448,6 +448,7 @@ def forward_backward_step(
loss = self.loss_fn(pred, labels)
# need to free to before bwd to avoid peaking memory
del pred
logger.info("backward")
loss.backward()

return loss
Expand Down
Loading