Skip to content

Skip reduce total tokens in every step & Fix total samples for sp resume#1652

Open
jayhenry wants to merge 10 commits intoInternLM:mainfrom
jayhenry:skip_reduce_tokens
Open

Skip reduce total tokens in every step & Fix total samples for sp resume#1652
jayhenry wants to merge 10 commits intoInternLM:mainfrom
jayhenry:skip_reduce_tokens

Conversation

@jayhenry
Copy link
Copy Markdown
Collaborator

@jayhenry jayhenry commented Apr 2, 2026

No description provided.

@jayhenry jayhenry changed the title Skip reduce total tokens in every step Skip reduce total tokens in every step & Fix total samples for sp resume Apr 3, 2026
return True

def _save_dataloader(self, dataloader_path: Path | str):
def _save_dataloader(self, dataloader_path: Path | str) -> int:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

_save_dataloader should only save rather than return the total_consumed_steps

approximate_total_consumed_tokens = (
self._init_total_tokens + self._local_total_consumed_tokens * self.world_size
)
approximate_total_consumed_tokens_per_rank = approximate_total_consumed_tokens / self.world_size
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

approximate_total_consumed_tokens_per_rank could be incorrect if world_size changed

Args:
state_dict (dict): The state of the sampler.
"""
tc = int(state_dict.get("total_consumed_steps", 0))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Avoid single charactor short abbr

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