Skip to content

Commit c3d7ddd

Browse files
committed
Update fixes for b/498090408 and b/498080408 to be more concise.
1 parent 244b95b commit c3d7ddd

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

axlearn/common/flash_attention/tpu_paged_attention.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ def __call__(
258258

259259
in_specs = [
260260
q_block_spec, # Query
261-
pl.BlockSpec(memory_space=None), # Key pages
262-
pl.BlockSpec(memory_space=None), # Value pages
261+
pl.BlockSpec(memory_space=pl.ANY), # Key pages
262+
pl.BlockSpec(memory_space=pl.ANY), # Value pages
263263
bias_spec, # Bias
264264
logit_sink_spec, # Logit sink
265265
]

axlearn/common/trainer_test.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import tempfile
1414
import unittest
1515
from collections.abc import Sequence
16+
from packaging import version
1617
from typing import Any, Callable, Literal, Optional
1718

1819
import chex
@@ -535,11 +536,11 @@ def mock_compile_train_step(*args, compiler_options=None, **kwargs):
535536
if not enable_python_cache:
536537
# As of Jax >= 0.6.0, enable_python_cache=False no longer affects the
537538
# AOT compilation path. We now expect the cache hits to be 0
538-
# if jax.__version__ >= "0.6.0":
539-
pytest.skip(
540-
# pylint: disable-next=line-too-long
541-
"AOT compilation path is not affected by 'enable_python_cache' with Jax >= 0.6.0"
542-
)
539+
if version.parse(jax.__version__) >= version.parse("0.6.0"):
540+
pytest.skip(
541+
# pylint: disable-next=line-too-long
542+
"AOT compilation path is not affected by 'enable_python_cache' with Jax >= 0.6.0"
543+
)
543544
# We expect to have hit the lowering cache on all but one step.
544545
self.assertEqual(end_cache_hits - start_cache_hits, cfg.max_step - 1)
545546
self.assertEqual(mocked_compile_fn.call_count, cfg.max_step)
@@ -551,11 +552,11 @@ def mock_compile_train_step(*args, compiler_options=None, **kwargs):
551552
self.assertEqual(compiled_with_options_call_count[0], 2)
552553
else:
553554
if not enable_python_cache:
554-
# if jax.__version__ >= "0.6.0":
555-
pytest.skip(
556-
# pylint: disable-next=line-too-long
557-
"AOT compilation path is not affected by 'enable_python_cache' with Jax >= 0.6.0"
558-
)
555+
if version.parse(jax.__version__) >= version.parse("0.6.0"):
556+
pytest.skip(
557+
# pylint: disable-next=line-too-long
558+
"AOT compilation path is not affected by 'enable_python_cache' with Jax >= 0.6.0"
559+
)
559560
self.assertEqual(end_cache_hits - start_cache_hits, cfg.max_step - 1)
560561
self.assertEqual(mocked_compile_fn.call_count, cfg.max_step)
561562
else:
@@ -607,15 +608,12 @@ def test_compile_train_step(self, *, platform, mesh_shape):
607608
# In a single-host environment, both compiled functions should match.
608609
# Skip this part of the test if Jax >= 0.8.2 as the behavior changes
609610
# TODO(samuel-andersen): Investigate why this behavior has changed
610-
# TEMP FOR 0.10.0DEV
611-
'''
612-
if jax.__version__ < "0.8.2":
611+
if version.parse(jax.__version__) < version.parse("0.8.2"):
613612
self.assertEqual(compiled_without_args.as_text(), compiled_with_input_batch.as_text())
614613
self.assertEqual(
615614
aot_model_analysis(compiled_without_args),
616615
aot_model_analysis(compiled_with_input_batch),
617616
)
618-
'''
619617

620618
# A version compiled with non-default compiled args should be different.
621619
compiled_with_compiler_options = trainer.compile_train_step(
@@ -628,9 +626,7 @@ def test_compile_train_step(self, *, platform, mesh_shape):
628626
trainer_state=trainer.trainer_state, input_batch=input_batch
629627
)
630628
# Skip this part of the test if Jax >= 0.8.2 as the behavior changes
631-
# TEMP FOR 0.10.0DEV
632-
'''
633-
if jax.__version__ < "0.8.2":
629+
if version.parse(jax.__version__) < version.parse("0.8.2"):
634630
self.assertEqual(
635631
compiled_without_args.as_text(),
636632
compiled_with_trainer_state_and_input_batch.as_text(),
@@ -639,7 +635,7 @@ def test_compile_train_step(self, *, platform, mesh_shape):
639635
aot_model_analysis(compiled_without_args),
640636
aot_model_analysis(compiled_with_trainer_state_and_input_batch),
641637
)
642-
'''
638+
643639
@parameterized.parameters(
644640
{"return_evaler_summaries": None},
645641
{"return_evaler_summaries": True},

0 commit comments

Comments
 (0)