Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve our mup implementation #837

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'main' into improved-mup
  • Loading branch information
Quentin-Anthony committed Mar 15, 2023
commit 5f09348a9f0b5289a3fab22cbe18731523c6b21f
44 changes: 24 additions & 20 deletions megatron/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,20 @@ def save_base_shapes(neox_args, base_shapes, use_cache):
print("Please install torchdistx https://github.com/pytorch/torchdistx")
raise Exception
base_model = torchdistx.deferred_init.deferred_init(GPT2ModelPipe(
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache))
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache,
)
else:
base_model = GPT2ModelPipe(
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache)
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache,
)

print(f'MEM AFTER BASE MUP: {torch.cuda.memory_allocated(device_index)} on rank {torch.distributed.get_rank()}')

Expand Down Expand Up @@ -123,18 +125,20 @@ def save_base_shapes(neox_args, base_shapes, use_cache):
print("Please install torchdistx https://github.com/pytorch/torchdistx")
raise Exception
delta_model = torchdistx.deferred_init.deferred_init(GPT2ModelPipe(
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache))
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache,
)
else:
delta_model = GPT2ModelPipe(
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache)
neox_args=neox_args,
num_tokentypes=0,
parallel_output=True,
topology=mpu.get_topology(),
use_cache=use_cache,
)

print(f'MEM AFTER BASE MUP: {torch.cuda.memory_allocated(device_index)} on rank {torch.distributed.get_rank()}')

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.