-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move tests from UnitTests.yml to tests files.
This change moves out train and decode tests into separate files, so they can be tested using pytest rather than explicitly being invoked from UnitTests.yml. This will allow us, in a subsequent PR, to parallelize the execution of these tests by utilizing pytest parallelization support. Several end-to-end tests are still being invoked from UnitTests.yml. This does not seem like the right place, and will hopefully be addressed in the future.
- Loading branch information
Showing
26 changed files
with
628 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
"""Short test for decode with int8 quantization""" | ||
import os | ||
import unittest | ||
import pytest | ||
from decode import main as decode_main | ||
from absl.testing import absltest | ||
|
||
|
||
class Train(unittest.TestCase): | ||
"""Tests decode with int8 quantization""" | ||
|
||
# Shared parameters | ||
CONFIG = [ | ||
None, | ||
"configs/base.yml", | ||
r"base_output_directory=gs://runner-maxtext-logs", | ||
"run_name=runner_test", | ||
r"dataset_path=gs://maxtext-dataset", | ||
"steps=2", | ||
"enable_checkpointing=False", | ||
"ici_tensor_parallelism=4", | ||
"max_target_length=128", | ||
"per_device_batch_size=1", | ||
"quantization=int8", | ||
"quantize_kvcache=True", | ||
r"tokenizer_path=../assets/tokenizer.llama2", | ||
] | ||
|
||
@pytest.mark.tpu_only | ||
def test_default_config(self): | ||
decode_main(Train.CONFIG) | ||
|
||
def test_default_config_dot_product(self): | ||
decode_main(Train.CONFIG + ["attention=dot_product"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
absltest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
"""Short test for decode with per_device_batch_size < 1""" | ||
import os | ||
import unittest | ||
import pytest | ||
from decode import main as decode_main | ||
from absl.testing import absltest | ||
|
||
|
||
class Train(unittest.TestCase): | ||
"""Tests decode with per_device_batch_size < 1""" | ||
|
||
# Shared parameters | ||
CONFIG = [ | ||
None, | ||
"configs/base.yml", | ||
r"base_output_directory=gs://runner-maxtext-logs", | ||
"run_name=runner_test", | ||
r"dataset_path=gs://maxtext-dataset", | ||
"steps=2", | ||
"enable_checkpointing=False", | ||
"ici_tensor_parallelism=4", | ||
"max_target_length=128", | ||
"per_device_batch_size=.25", | ||
r"tokenizer_path=../assets/tokenizer.llama2", | ||
] | ||
|
||
@pytest.mark.tpu_only | ||
def test_default_config(self): | ||
decode_main(Train.CONFIG) | ||
|
||
def test_default_config_dot_product(self): | ||
decode_main(Train.CONFIG + ["attention=dot_product"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
absltest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
"""Short test for decode""" | ||
import os | ||
import unittest | ||
import pytest | ||
from decode import main as decode_main | ||
from absl.testing import absltest | ||
|
||
|
||
class Train(unittest.TestCase): | ||
"""Tests decode""" | ||
|
||
# Shared parameters | ||
CONFIG = [ | ||
None, | ||
"configs/base.yml", | ||
r"base_output_directory=gs://runner-maxtext-logs", | ||
"run_name=runner_test", | ||
r"dataset_path=gs://maxtext-dataset", | ||
"steps=2", | ||
"enable_checkpointing=False", | ||
"ici_tensor_parallelism=4", | ||
"max_target_length=128", | ||
"per_device_batch_size=1", | ||
r"tokenizer_path=../assets/tokenizer.llama2", | ||
] | ||
|
||
@pytest.mark.tpu_only | ||
def test_default_config(self): | ||
decode_main(Train.CONFIG) | ||
|
||
def test_default_config_dot_product(self): | ||
decode_main(Train.CONFIG + ["attention=dot_product"]) | ||
|
||
|
||
if __name__ == "__main__": | ||
absltest.main() |
Oops, something went wrong.