镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-20 18:17:06 +00:00
fix(pi05): restore tied embed tokens on load (#20)
Co-authored-by: shiki42 <shiki42@users.noreply.github.com>
这个提交包含在:
@ -166,3 +166,22 @@ def test_config_creation():
|
||||
except Exception as e:
|
||||
print(f"Config creation failed: {e}")
|
||||
raise
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"lm_head_key",
|
||||
[
|
||||
"paligemma_with_expert.paligemma.lm_head.weight",
|
||||
"model.paligemma_with_expert.paligemma.lm_head.weight",
|
||||
],
|
||||
)
|
||||
def test_fix_pytorch_state_dict_keys_restores_tied_embed_tokens(lm_head_key: str):
|
||||
policy = object.__new__(PI05Policy)
|
||||
lm_head = torch.randn(8, 4)
|
||||
|
||||
fixed = PI05Policy._fix_pytorch_state_dict_keys(policy, {lm_head_key: lm_head}, model_config=None)
|
||||
|
||||
embed_tokens_key = "model.paligemma_with_expert.paligemma.model.language_model.embed_tokens.weight"
|
||||
assert embed_tokens_key in fixed
|
||||
assert torch.equal(fixed[embed_tokens_key], lm_head)
|
||||
assert fixed[embed_tokens_key].data_ptr() != lm_head.data_ptr()
|
||||
|
||||
在新工单中引用
屏蔽一个用户