add MMLU benchmark val / test - #1
Merged
Merged
Conversation
HIT-cwh
added a commit
that referenced
this pull request
Aug 28, 2023
* add dataset pipeline doc * add dataset pipeline doc * fix bugs * fix bugs * refine doc * fix bugs * Update README.md * Update README.md * update docs (#1) * Update README.md * fix pre-commit * rename xTuner to XTuner * Update README.md * Update README.md * Update README.md * Update README.md * fix pre-commit * Update README.md * Update README.md * Update README.md * Update README.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update finetune.md * Update finetune.md * Update chat.md * fix pre-commit * add zh_cn chat and finetune doc * Update chat.md * Update README.md * del tool_usage * Update README.md * Update chat.md * Update chat.md * Update README.md * Update README.md * Update README_zh-CN.md * Update README.md * Update README_zh-CN.md * fix pre-commit * Update README_zh-CN.md * Update README.md * Update README_zh-CN.md * Update README_zh-CN.md * Update README_zh-CN.md * Update README_zh-CN.md * refactor data pipeline doc * add colorist llama2 * fix incremental pretraining doc --------- Co-authored-by: LZHgrla <36994684+LZHgrla@users.noreply.github.com> Co-authored-by: LZHgrla <linzhihao@pjlab.org.cn>
llkn-2
pushed a commit
to llkn-2/xtuner
that referenced
this pull request
Jul 31, 2024
* add mmlu dataset configs * add mmlu metric * fix bugs * implement predict for sft model * remove dummy file * clean code * modify prefix for mmlu test * add test.py * add mmlu val/test for gunaco config * use float16 for gunaco * add METAINFO and add logger
llkn-2
pushed a commit
to llkn-2/xtuner
that referenced
this pull request
Jul 31, 2024
* add dataset pipeline doc * add dataset pipeline doc * fix bugs * fix bugs * refine doc * fix bugs * Update README.md * Update README.md * update docs (InternLM#1) * Update README.md * fix pre-commit * rename xTuner to XTuner * Update README.md * Update README.md * Update README.md * Update README.md * fix pre-commit * Update README.md * Update README.md * Update README.md * Update README.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update chat.md * Update finetune.md * Update finetune.md * Update chat.md * fix pre-commit * add zh_cn chat and finetune doc * Update chat.md * Update README.md * del tool_usage * Update README.md * Update chat.md * Update chat.md * Update README.md * Update README.md * Update README_zh-CN.md * Update README.md * Update README_zh-CN.md * fix pre-commit * Update README_zh-CN.md * Update README.md * Update README_zh-CN.md * Update README_zh-CN.md * Update README_zh-CN.md * Update README_zh-CN.md * refactor data pipeline doc * add colorist llama2 * fix incremental pretraining doc --------- Co-authored-by: LZHgrla <36994684+LZHgrla@users.noreply.github.com> Co-authored-by: LZHgrla <linzhihao@pjlab.org.cn>
HAOCHENYE
added a commit
that referenced
this pull request
Jun 29, 2026
The previous V4 layer was split across three classes that existed only to
work around an over-narrow abstraction:
MoEDecoderLayer (parent)
└── _V4InnerBlock ← inherited but never used the parent's forward;
added attn_block / ffn_block / set_context
to fit an HCInnerBlock protocol
└── HCDecoderLayer ← "generic" wrapper with V4 as its only user;
``attn_block(x) -> x`` couldn't carry DSA's
position_embeddings / seq_ctx / input_ids,
so set_context shoved them on the inner block
as mutable state
└── _V4DecoderLayer ← bridge that called set_context, called the
HC wrapper, then read the stashed router
results back off the inner block
Three classes, one ``set_context`` side-channel, one ``_last_router_results``
stash-and-grab, one ``assert hc_layer.inner is inner`` to police a
dual-registration invariant — to express what is conceptually one decoder
layer (HC residual mix + DSA + MoE FFN). Per CLAUDE.md rule #1: "do not
justify patch-on-patch, layered, spaghetti-like implementations in the name
of backward-compatibility protection". The "generic HC wrapper" abstraction
had exactly one user.
Replace all three with :class:`V4DecoderLayer` that owns every submodule and
parameter directly:
V4DecoderLayer.forward(hidden_states,
*, position_embeddings,
position_embeddings_compressed,
seq_ctx, input_ids)
-> (hidden_states_out, router_logits, router_weights)
All inputs flow through arguments; router results flow out through the
tuple; no hidden state on ``self`` between calls. The compile-target
sub-methods (``_attn_compute`` / ``_ffn_pre_compute`` / ``_ffn_post_compute``
/ ``_shared_experts_forward``) stay as separate methods so
``V4_EP_COMPILE_CFG`` can target them individually with the same boundary
the previous ``_V4InnerBlock`` exposed.
Knock-on changes:
* ``hc_block.py`` keeps ``hc_pre`` / ``hc_post`` / ``HCWrapperConfig`` /
``_unshard_hc_params`` (the math + DTensor helper) but deletes the
``HCDecoderLayer`` class and ``HCInnerBlock`` protocol.
* ``decoder_layer/__init__.py`` re-exports drop ``HCDecoderLayer`` and
``HCInnerBlock``.
* ``DeepSeekV4._build_one_layer`` constructs ``V4DecoderLayer`` directly
(was: ``_V4InnerBlock`` + ``HCDecoderLayer`` + ``_V4DecoderLayer``).
* ``_translate_layer_tail`` no longer strips ``hc_layer.`` or
``hc_layer.inner.`` prefixes — params now arrive at the flat
``layers.L.hc_attn_*`` / ``layers.L.input_layernorm.weight`` /
``layers.L.experts.*`` layout.
* ``V4_EP_COMPILE_CFG`` / ``V4_NON_EP_COMPILE_CFG`` point at
``V4DecoderLayer._attn_compute`` / ``_ffn_pre_compute`` /
``_ffn_post_compute`` (was: ``_V4InnerBlock.attn_block`` / equivalents).
* ``tests/module/test_hc_block.py`` no longer exercises a (now-deleted)
wrapper class; it tests ``hc_pre`` / ``hc_post`` directly with the same
closed-form assertions on the degenerate-init path.
Verified: 51 module + V4 model tests pass (the two ``to_hf_key_list_coverage``
checks that need a local BF16 checkpoint are skipped). Sample of the new
flat param layout under a 2-layer toy model::
hc_head_fn -> hc_head_fn
layers.0.hc_attn_fn -> layers.0.hc_attn_fn
layers.0.input_layernorm.weight -> layers.0.attn_norm.weight
layers.0.post_attention_layernorm.weight -> layers.0.ffn_norm.weight
layers.0.self_attn.wq_a.weight -> layers.0.attn.wq_a.weight
layers.0.experts.fused_w1w3.weight -> [N × layers.0.ffn.experts.i.{w1,w3}.weight]
layers.0.shared_experts.gate_proj.weight -> layers.0.ffn.shared_experts.w1.weight
No HF-side semantics change — the HF key bridge produces the same target
names as before; only the XTuner-side path stripping is simpler.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MMLU benchmark val / test. This implementation follows the approach of the original implementation and QLoRA.
Note: We use the preprocessed MMLU dataset from QLoRA, instead of the original dataset.