Skip to content

[Refactor] Refactor loss context API to support multiple loss types#1569

Open
HAOCHENYE wants to merge 2 commits intogh/HAOCHENYE/16/basefrom
gh/HAOCHENYE/16/head
Open

[Refactor] Refactor loss context API to support multiple loss types#1569
HAOCHENYE wants to merge 2 commits intogh/HAOCHENYE/16/basefrom
gh/HAOCHENYE/16/head

Conversation

@HAOCHENYE
Copy link
Collaborator

@HAOCHENYE HAOCHENYE commented Mar 12, 2026

Stack from ghstack (oldest at bottom):

Change loss context from single object to dict-based API:

  • Update loss_cfg.build() to accept data parameter as dict
  • Change ModelItem.loss_ctx to dict with loss type keys (e.g. 'lm')
  • Update model forward pass to accept loss_ctx_dict parameter
  • Update all tests to use new dict-based loss context API

[ghstack-poisoned]
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 13, 2026
Change loss context from single object to dict-based API:
- Update loss_cfg.build() to accept data parameter as dict
- Change ModelItem.loss_ctx to dict with loss type keys (e.g. 'lm')
- Update model forward pass to accept loss_ctx_dict parameter
- Update all tests to use new dict-based loss context API


ghstack-source-id: f3a7194
Pull-Request: InternLM#1569
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 13, 2026
Change loss context from single object to dict-based API:
- Update loss_cfg.build() to accept data parameter as dict
- Change ModelItem.loss_ctx to dict with loss type keys (e.g. 'lm')
- Update model forward pass to accept loss_ctx_dict parameter
- Update all tests to use new dict-based loss context API


ghstack-source-id: f3a7194
Pull-Request: InternLM#1569
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 16, 2026
Change loss context from single object to dict-based API:
- Update loss_cfg.build() to accept data parameter as dict
- Change ModelItem.loss_ctx to dict with loss type keys (e.g. 'lm')
- Update model forward pass to accept loss_ctx_dict parameter
- Update all tests to use new dict-based loss context API


ghstack-source-id: f3a7194
Pull-Request: InternLM#1569
[ghstack-poisoned]
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 17, 2026
Change loss context from single object to dict-based API:
- Update loss_cfg.build() to accept data parameter as dict
- Change ModelItem.loss_ctx to dict with loss type keys (e.g. 'lm')
- Update model forward pass to accept loss_ctx_dict parameter
- Update all tests to use new dict-based loss context API


ghstack-source-id: e27a1aa
Pull-Request: InternLM#1569
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.

1 participant