Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/api_tests/test_magi_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def test_simple_model_timing_class_function_instance_method(self):
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.dim = 128
self.dim = 1024
self.layers = nn.ModuleList([nn.Linear(self.dim, self.dim) for _ in range(4)])
self.norms = nn.ModuleList([nn.LayerNorm(self.dim) for _ in range(4)])

Expand All @@ -567,8 +567,8 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
return x

device = torch.device("cuda:0")
seq_len = 256
test_input = torch.randn(seq_len, 128, device=device)
seq_len = 512
test_input = torch.randn(seq_len, 1024, device=device)

native = SimpleModel().to(device).eval()

Expand Down Expand Up @@ -632,16 +632,16 @@ class CompiledNonModulePerf(NonModulePerf):
def forward(self, x: torch.Tensor) -> torch.Tensor:
return super().forward(x)

non_module_native = NonModulePerf(128)
non_module_native = NonModulePerf(1024)

non_module_cls = CompiledNonModulePerf(128)
non_module_cls = CompiledNonModulePerf(1024)
non_module_cls.copy_from(non_module_native)

non_module_inst_obj = NonModulePerf(128)
non_module_inst_obj = NonModulePerf(1024)
non_module_inst_obj.copy_from(non_module_native)
non_module_inst = magi_compile(non_module_inst_obj, dynamic_arg_dims={"x": 0})

non_module_mtd_obj = NonModulePerf(128)
non_module_mtd_obj = NonModulePerf(1024)
non_module_mtd_obj.copy_from(non_module_native)
non_module_mtd_obj.step = magi_compile(non_module_mtd_obj.step, dynamic_arg_dims={"x": 0})

Expand Down
Loading