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

Basic implementation of WeightedCrossEntropy torchmetric. #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alxmrs
Copy link
Collaborator

@alxmrs alxmrs commented Jan 31, 2025

[WIP]

@@ -835,13 +836,47 @@ def forward(
return hidden_states, all_hidden_states


class WeightedCrossEntropy(LanguageCrossEntropy):
Copy link
Member

Choose a reason for hiding this comment

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

I think a better approach for this would be to subclass torchmetrics.Metric directly since it would then be portable across Lightning, Composer and Torchtitan (at the very least), without needing composer installed. This is also pretty much overriding everything LanguageCrossEntropy does, so I see little advantage to it.

@@ -12,6 +12,7 @@ dependencies:
- pytorch-cuda=12.1
- pip:
- causal-conv1d==1.1.3.post1
- mosaicml
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove this re: https://github.com/Open-Athena/mdlm/pull/1/files#r1937418877. It's great that Composer is designed to be decoupled from models like that. Torchtitan is too AFAIK. Lightning is not, and I'm not sure what that means yet for running lightning models like this on other training frameworks yet. Either way, there shouldn't be any need to depend on composer in mdlm.

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