Skip to content

calcualte some of norm on raw gradient#1

Open
rakkit wants to merge 1 commit into
SDLAML:llm-0.3.1from
rakkit:llm-0.3.1-improving-disco-norm-track
Open

calcualte some of norm on raw gradient#1
rakkit wants to merge 1 commit into
SDLAML:llm-0.3.1from
rakkit:llm-0.3.1-improving-disco-norm-track

Conversation

@rakkit

@rakkit rakkit commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@rakkit rakkit requested a review from ofivite January 9, 2026 01:29
for ep_idx in range(u.shape[0]):
update_norms = calculate_norm(
u[ep_idx], self.norms_to_log, transpose=transpose
-lr * u[ep_idx],

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bugs in old code, should mul. -lr

import torch
from torch.distributed.tensor import DTensor

DONT_TRACK_RAW_GRADIENT = os.getenv("DONT_TRACK_RAW_GRADIENT", "1") == "1"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can set export DONT_TRACK_RAW_GRADIENT=1 as enviroment varible to disble all of these new changes in case we want to reproduce smth



@torch.no_grad()
def rank(W):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual "rank" on (raw) gradient

@ofivite ofivite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just need to change the name of metrics from track_update_{norm_name} to track_raw_grad_{norm_name} for those metrics in METRICS_ON_RAW_GRADIENT when DONT_TRACK_RAW_GRADIENT = False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants