Skip to content

Dsv4#1937

Open
HAOCHENYE wants to merge 7 commits into
mainfrom
dsv4
Open

Dsv4#1937
HAOCHENYE wants to merge 7 commits into
mainfrom
dsv4

Conversation

@HAOCHENYE

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread docs/design/mtp_loss_context.md Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

drop it, unnecessary changes.

Comment thread docs/design/mtp_sp_support.md Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

drop it, unnecessary changes.

Comment thread tests/model/test_deepseek_v4_moe.py Outdated
# PR9; the model's `mtp_config=None` here means none should appear) but
# require ≥ 90% coverage for the main stack.
coverage_ratio = covered / len(xtuner_names)
assert coverage_ratio >= 0.90, (

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If it is only to skip the mtp check, please explicitly ensure that all parameters before mtp are fully loaded, rather than using magic numbers like 90%, and indicate that the mtp test is a TODO item

Comment thread tests/model/test_deepseek_v4_moe.py Outdated
assert cfg.mtp_config is not None
assert cfg.mtp_config.num_layers == 1

def test_to_hf_key_list_coverage(self) -> None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The testing method for parameter alignment is too indirect. It is recommended to adopt the following testing approach:

Load a DeepSeekv4-flash model with only one layer (num_hidden_layers=1), then execute load and save, and test whether the keys obtained from load and save align with the original weights at the bitwisze level

Comment thread tests/model/test_deepseek_v4_moe.py Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Combine this test and the layer_parity test into one file

with torch.no_grad():
hf_out = _run_hf_layer(hf_model, layer_idx, hidden_states, input_ids, position_ids)
xt_out = _run_xtuner_layer(xtuner_layer, hidden_states, input_ids, position_ids, hf_model)
torch.testing.assert_close(xt_out, hf_out, atol=atol, rtol=atol)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Here are a few DeepSeekv4 tests:

  1. Run hash router layer alone
  2. Run csa alone
  3. Run hca alone
  4. Run a minimum DeepSeekv4-flash, these layers all have

Finally, all tests should go through the HF path to ensure bitwise alignment!

xt_out = _run_xtuner_layer(xtuner_layer, hidden_states, input_ids, position_ids, hf_model)
torch.testing.assert_close(xt_out, hf_out, atol=atol, rtol=atol)

def test_subcomponent_probe(self, capsys) -> None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I completely don't get the point of this test? If it's just for temporary debugging to show where it forked, please comment it out

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

All op and submodule level tests have the only reference being the Hugging Face implementation, and then control the absolute and relative errors

TARGET_DEVICE = get_device()


def _patch_sympy_mod_eval_negative_subs() -> None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Double check is this necessary

_patch_sympy_mod_eval_negative_subs()


def _patch_triton_max_block_xblock() -> None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

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