Skip to content

[Refactor] Rename CELossContext to LMHeadLossContext and refactor loss context base class#1571

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

[Refactor] Rename CELossContext to LMHeadLossContext and refactor loss context base class#1571
HAOCHENYE wants to merge 2 commits intogh/HAOCHENYE/18/basefrom
gh/HAOCHENYE/18/head

Conversation

@HAOCHENYE
Copy link
Collaborator

@HAOCHENYE HAOCHENYE commented Mar 12, 2026

Stack from ghstack (oldest at bottom):


  • Rename CELossContext to LMHeadLossContext for better semantic clarity
  • Refactor BaseLossContext to be more abstract by removing LM-specific logic
  • Move eager_mode and chunk_mode implementations from base class to LMHeadLossContext
  • Make loss_ctx_cls and _loss_kwargs_cls abstract properties in BaseLossConfig
  • Remove sp_split() and to() implementations from BaseLossKwargs base class
  • Move sp_split() and to() to CELossKwargs subclass
  • Update BaseRLLossKwargs to properly inherit and extend sp_split() and to() methods
  • Add deprecation alias: CELossContext = LMHeadLossContext for backward compatibility
  • Export LMHeadLossContext in init.py

[ghstack-poisoned]
HAOCHENYE added a commit that referenced this pull request Mar 12, 2026
…s context base class

- Rename CELossContext to LMHeadLossContext for better semantic clarity
- Refactor BaseLossContext to be more abstract by removing LM-specific logic
- Move eager_mode and chunk_mode implementations from base class to LMHeadLossContext
- Make loss_ctx_cls and _loss_kwargs_cls abstract properties in BaseLossConfig
- Remove sp_split() and to() implementations from BaseLossKwargs base class
- Move sp_split() and to() to CELossKwargs subclass
- Update BaseRLLossKwargs to properly inherit and extend sp_split() and to() methods
- Add deprecation alias: CELossContext = LMHeadLossContext for backward compatibility
- Export LMHeadLossContext in __init__.py


ghstack-source-id: e6368aa
Pull-Request: #1571
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 13, 2026
…s context base class

- Rename CELossContext to LMHeadLossContext for better semantic clarity
- Refactor BaseLossContext to be more abstract by removing LM-specific logic
- Move eager_mode and chunk_mode implementations from base class to LMHeadLossContext
- Make loss_ctx_cls and _loss_kwargs_cls abstract properties in BaseLossConfig
- Remove sp_split() and to() implementations from BaseLossKwargs base class
- Move sp_split() and to() to CELossKwargs subclass
- Update BaseRLLossKwargs to properly inherit and extend sp_split() and to() methods
- Add deprecation alias: CELossContext = LMHeadLossContext for backward compatibility
- Export LMHeadLossContext in __init__.py


ghstack-source-id: e6368aa
Pull-Request: InternLM#1571
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 13, 2026
…s context base class

- Rename CELossContext to LMHeadLossContext for better semantic clarity
- Refactor BaseLossContext to be more abstract by removing LM-specific logic
- Move eager_mode and chunk_mode implementations from base class to LMHeadLossContext
- Make loss_ctx_cls and _loss_kwargs_cls abstract properties in BaseLossConfig
- Remove sp_split() and to() implementations from BaseLossKwargs base class
- Move sp_split() and to() to CELossKwargs subclass
- Update BaseRLLossKwargs to properly inherit and extend sp_split() and to() methods
- Add deprecation alias: CELossContext = LMHeadLossContext for backward compatibility
- Export LMHeadLossContext in __init__.py


ghstack-source-id: e6368aa
Pull-Request: InternLM#1571
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 16, 2026
…s context base class

- Rename CELossContext to LMHeadLossContext for better semantic clarity
- Refactor BaseLossContext to be more abstract by removing LM-specific logic
- Move eager_mode and chunk_mode implementations from base class to LMHeadLossContext
- Make loss_ctx_cls and _loss_kwargs_cls abstract properties in BaseLossConfig
- Remove sp_split() and to() implementations from BaseLossKwargs base class
- Move sp_split() and to() to CELossKwargs subclass
- Update BaseRLLossKwargs to properly inherit and extend sp_split() and to() methods
- Add deprecation alias: CELossContext = LMHeadLossContext for backward compatibility
- Export LMHeadLossContext in __init__.py


ghstack-source-id: e6368aa
Pull-Request: InternLM#1571
[ghstack-poisoned]
HAOCHENYE added a commit that referenced this pull request Mar 17, 2026
…s context base class

- Rename CELossContext to LMHeadLossContext for better semantic clarity
- Refactor BaseLossContext to be more abstract by removing LM-specific logic
- Move eager_mode and chunk_mode implementations from base class to LMHeadLossContext
- Make loss_ctx_cls and _loss_kwargs_cls abstract properties in BaseLossConfig
- Remove sp_split() and to() implementations from BaseLossKwargs base class
- Move sp_split() and to() to CELossKwargs subclass
- Update BaseRLLossKwargs to properly inherit and extend sp_split() and to() methods
- Add deprecation alias: CELossContext = LMHeadLossContext for backward compatibility
- Export LMHeadLossContext in __init__.py


ghstack-source-id: 67744a7
Pull-Request: #1571
HAOCHENYE added a commit to HAOCHENYE/xtuner that referenced this pull request Mar 17, 2026
…s context base class

- Rename CELossContext to LMHeadLossContext for better semantic clarity
- Refactor BaseLossContext to be more abstract by removing LM-specific logic
- Move eager_mode and chunk_mode implementations from base class to LMHeadLossContext
- Make loss_ctx_cls and _loss_kwargs_cls abstract properties in BaseLossConfig
- Remove sp_split() and to() implementations from BaseLossKwargs base class
- Move sp_split() and to() to CELossKwargs subclass
- Update BaseRLLossKwargs to properly inherit and extend sp_split() and to() methods
- Add deprecation alias: CELossContext = LMHeadLossContext for backward compatibility
- Export LMHeadLossContext in __init__.py


ghstack-source-id: 67744a7
Pull-Request: InternLM#1571
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