Skip to content

Commit 2c14472

Browse files
committed
lint: apply ruff-format to build_graph_test.py
1 parent e21e5b2 commit 2c14472

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

tests/build_graph_test.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5215,9 +5215,7 @@ def _build_paged_cache_model(
52155215
config = _base_config(**config_overrides)
52165216
model_cls = registry.get(model_type)
52175217
module = model_cls(config)
5218-
task = CausalLMTask(
5219-
paged_cache=True, page_size=self.PAGE_SIZE, num_pages=num_pages
5220-
)
5218+
task = CausalLMTask(paged_cache=True, page_size=self.PAGE_SIZE, num_pages=num_pages)
52215219
pkg = task.build(module, config)
52225220
return pkg["model"], config
52235221

@@ -5258,7 +5256,9 @@ def test_paged_cache_pool_shapes(self):
52585256
"""Verify page pools are [num_pages, page_size, kv_hidden]."""
52595257
model, config = self._build_paged_cache_model()
52605258
kv_hidden = config.num_key_value_heads * config.head_dim
5261-
pools = {inp.name: inp for inp in model.graph.inputs if inp.name.startswith("key_pool")}
5259+
pools = {
5260+
inp.name: inp for inp in model.graph.inputs if inp.name.startswith("key_pool")
5261+
}
52625262
assert pools, "No key_pool inputs found"
52635263
for inp in pools.values():
52645264
dims = list(inp.shape)
@@ -5269,9 +5269,7 @@ def test_paged_cache_pool_shapes(self):
52695269
def test_paged_cache_num_pages_dynamic_by_default(self):
52705270
"""Omitting num_pages leaves the pool's first dim symbolic."""
52715271
model, _ = self._build_paged_cache_model(num_pages=None)
5272-
key_pool0 = next(
5273-
inp for inp in model.graph.inputs if inp.name == "key_pool.0"
5274-
)
5272+
key_pool0 = next(inp for inp in model.graph.inputs if inp.name == "key_pool.0")
52755273
first_dim = next(iter(key_pool0.shape))
52765274
assert not isinstance(first_dim, int), (
52775275
f"Expected symbolic num_pages dim, got {first_dim!r}"
@@ -5286,9 +5284,7 @@ def test_paged_cache_graph_outputs(self):
52865284
assert "logits" in output_names
52875285
for i in range(num_layers):
52885286
assert f"updated_key_pool.{i}" in output_names, f"Missing updated_key_pool.{i}"
5289-
assert f"updated_value_pool.{i}" in output_names, (
5290-
f"Missing updated_value_pool.{i}"
5291-
)
5287+
assert f"updated_value_pool.{i}" in output_names, f"Missing updated_value_pool.{i}"
52925288
# No dynamic/static cache outputs
52935289
assert not any(n.startswith("present.") for n in output_names)
52945290
assert not any(n.startswith("updated_key_cache.") for n in output_names)

0 commit comments

Comments
 (0)