diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66398d4..5b5481c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,29 @@ # Contributing To Emerging-Optimizers +## Dependency + +Use [abseil-py](https://github.com/abseil/abseil-py/tree/main)'s **logging**, **testing** and **flags** instead of Python's own **logging**, **unittest** and **argparse**. + +## Coding Style + +We generally follow [Google's style guides](https://google.github.io/styleguide/) , with some exceptions: + +* Line length extended to 120 for Python and 100 for C++ code. +* Common use in PyTorch, which are prohibited by Google style, are allowed, including but not limited to: + * Import function, class, not just module + * Some special variable name, `x`, `dX`, etc. +* Allow common capitalized naming in Triton code. + +Although common, **mixed case is not allowed** in any code. + +Run pre-commit at local before submitting merge request. You can also read [.pre-commit-config.yaml]( .pre-commit-config.yaml) to understand what are being forced. The **flake8** and **mypy** settings are inherited from PyTorch. + +## Test + +All tests should be placed under [tests](tests). We aim for 100% test coverage for this tiny project. + +We use [abseil-py](https://github.com/abseil/abseil-py/tree/main) **testing** because it is easier to launch multi process than alternatives. + ## Signing Your Work * We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license. @@ -20,9 +44,9 @@ ``` Developer Certificate of Origin Version 1.1 - + Copyright (C) 2004, 2006 The Linux Foundation and its contributors. - + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. diff --git a/README.md b/README.md index 3cdcd93..9113ce7 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ # Emerging Optimizers + +## Overview + +Emerging Optimizers is a research project focused on understanding and optimizing the algorithmic behavior of Shampoo-class optimizers (Shampoo, SOAP, Muon, etc.) and their implications for performance and GPU systems in large language model training. + +## User guide + +Coming soon. diff --git a/tests/ci/test_placeholder.py b/tests/ci/test_placeholder.py deleted file mode 100644 index 0b0ca80..0000000 --- a/tests/ci/test_placeholder.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. -# -# 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 -# -# http://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. - - -def test_placeholder(): - """Should be True""" - assert True is True diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index e90f858..0000000 --- a/tests/conftest.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. -# -# 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 -# -# http://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. -import os - -import pytest - - -def pytest_addoption(parser): - """ - Additional command-line arguments passed to pytest. - For now: - --cpu: use CPU during testing (DEFAULT: GPU) - --use_local_test_data: use local test data/skip downloading from URL/GitHub (DEFAULT: False) - """ - parser.addoption( - "--cpu", action="store_true", help="pass that argument to use CPU during testing (DEFAULT: False = GPU)" - ) - parser.addoption( - "--with_downloads", - action="store_true", - help="pass this argument to active tests which download models from the cloud.", - ) - - -@pytest.fixture -def device(request): - """Simple fixture returning string denoting the device [CPU | GPU]""" - if request.config.getoption("--cpu"): - return "CPU" - else: - return "GPU" - - -@pytest.fixture(autouse=True) -def run_only_on_device_fixture(request, device): - """Fixture to skip tests based on the device""" - if request.node.get_closest_marker("run_only_on"): - if request.node.get_closest_marker("run_only_on").args[0] != device: - pytest.skip("skipped on this device: {}".format(device)) - - -@pytest.fixture(autouse=True) -def downloads_weights(request, device): - """Fixture to validate if the with_downloads flag is passed if necessary""" - if request.node.get_closest_marker("with_downloads"): - if not request.config.getoption("--with_downloads"): - pytest.skip( - "To run this test, pass --with_downloads option. It will download (and cache) models from cloud." - ) - - -@pytest.fixture(autouse=True) -def reset_env_vars(): - """Reset environment variables""" - # Store the original environment variables before the test - original_env = dict(os.environ) - - # Run the test - yield - - # After the test, restore the original environment - os.environ.clear() - os.environ.update(original_env) - - -def pytest_configure(config): - """ - Initial configuration of conftest. - The function checks if test_data.tar.gz is present in tests/.data. - If so, compares its size with github's test_data.tar.gz. - If file absent or sizes not equal, function downloads the archive from github and unpacks it. - """ - config.addinivalue_line( - "markers", - "run_only_on(device): runs the test only on a given device [CPU | GPU]", - ) - config.addinivalue_line( - "markers", - "with_downloads: runs the test using data present in tests/.data", - )