[Performance] Optimize MammothModa2 AR → DiT hidden-state transfer (#7102)
Signed-off-by: kunkunblueberry <1833921874@qq.com> Signed-off-by: kunkun <72174834+kunkunblueberry@users.noreply.github.com>
This commit is contained in:
1 parent
9f85b3722e
commit
c68eadbbe0
4 files changed
+212
-5
No files matched your search
@@ -33,6 +33,18 @@ def test_tensor_serialization():
|
||||
assert torch.equal(tensor, deserialized)
|
||||
|
||||
|
||||
def test_bfloat16_tensor_serialization():
|
||||
"""The raw tensor serializer preserves the Mammoth BF16 wire dtype."""
|
||||
import torch
|
||||
|
||||
tensor = torch.tensor([[1.0, -2.5], [3.25, 4.5]], dtype=torch.bfloat16)
|
||||
serialized = OmniSerializer.serialize({"text_prompt_embeds": tensor})
|
||||
deserialized = OmniSerializer.deserialize(serialized)
|
||||
|
||||
assert deserialized["text_prompt_embeds"].dtype == torch.bfloat16
|
||||
assert torch.equal(deserialized["text_prompt_embeds"], tensor)
|
||||
|
||||
|
||||
def test_noncontiguous_tensor_serialization():
|
||||
"""Test torch.Tensor serialization for strided views."""
|
||||
import torch
|
||||
|
||||
Reference in new issue
Block a user