Skip to content

Commit f2b4feb

Browse files
Merge pull request #874 from fsschneider/ruff
Switch from yapf/pylint/isort to ruff
2 parents 2f3c23c + 09aca7f commit f2b4feb

File tree

255 files changed

+17500
-15402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+17500
-15402
lines changed

.github/workflows/linting.yml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,35 @@ name: Linting
33
on: [push, pull_request]
44

55
jobs:
6-
pylint:
6+
ruff-linting:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
1010
- name: Set up Python 3.11.10
1111
uses: actions/setup-python@v2
1212
with:
1313
python-version: 3.11.10
14-
- name: Install pylint
14+
- name: Install ruff
1515
run: |
1616
python -m pip install --upgrade pip
17-
pip install pylint==2.16.1
18-
- name: Run pylint
17+
pip install ruff==0.12.0
18+
- name: Run ruff linter
1919
run: |
20-
pylint algoperf
21-
pylint reference_algorithms
22-
pylint prize_qualification_baselines
23-
pylint submission_runner.py
24-
pylint tests
20+
ruff check
2521
26-
isort:
22+
ruff-formatter:
2723
runs-on: ubuntu-latest
2824
steps:
2925
- uses: actions/checkout@v2
3026
- name: Set up Python 3.11.10
3127
uses: actions/setup-python@v2
3228
with:
3329
python-version: 3.11.10
34-
- name: Install isort
30+
- name: Install ruff
3531
run: |
3632
python -m pip install --upgrade pip
37-
pip install isort==5.12.0
38-
- name: Run isort
33+
pip install ruff==0.12.0
34+
- name: Run ruff formatter
3935
run: |
40-
isort . --check --diff
36+
ruff format --check
4137
42-
yapf:
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@v2
46-
- name: Set up Python 3.11.10
47-
uses: actions/setup-python@v2
48-
with:
49-
python-version: 3.11.10
50-
- name: Install yapf
51-
run: |
52-
python -m pip install --upgrade pip
53-
pip install yapf==0.32 toml
54-
- name: Run yapf
55-
run: |
56-
yapf . --diff --recursive

.pre-commit-config.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
repos:
2-
- repo: https://github.com/google/yapf
3-
rev: v0.32.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.12.0
45
hooks:
5-
- id: yapf
6-
args: ["--in-place", "--parallel", "--verbose", "--recursive"]
7-
- repo: https://github.com/pycqa/isort
8-
rev: 5.10.1
9-
hooks:
10-
- id: isort
11-
- repo: https://github.com/pycqa/pylint
12-
rev: v2.16.1
13-
hooks:
14-
- id: pylint
6+
# Run the linter (don't change files).
7+
- id: ruff-check
8+
# Run the formatter (don't change files).
9+
- id: ruff-format
10+
args: ["--check"]

README.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
<a href="https://arxiv.org/abs/2306.07179" target="_blank">Benchmark</a>/<a href="https://openreview.net/forum?id=CtM5xjRSfm" target="_blank">Results</a> Paper
1515
</p>
1616

17-
[![CI](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/CI.yml/badge.svg)](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/CI.yml)
18-
[![Lint](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/linting.yml/badge.svg)](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/linting.yml)
19-
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/mlcommons/algorithmic-efficiency/blob/main/LICENSE.md)
20-
[![Code style: yapf](https://img.shields.io/badge/code%20style-yapf-orange)](https://github.com/google/yapf)
21-
[![Discord](https://dcbadge.vercel.app/api/server/5FPXK7SMt6?style=flat)](https://discord.gg/5FPXK7SMt6)
17+
[![CI Status](https://img.shields.io/github/actions/workflow/status/mlcommons/algorithmic-efficiency/CI.yml?style=flat-square&logo=github&label=CI)](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/CI.yml)
18+
[![Linting Status](https://img.shields.io/github/actions/workflow/status/mlcommons/algorithmic-efficiency/linting.yml?style=flat-square&logo=github&label=Linting)](https://github.com/mlcommons/algorithmic-efficiency/actions/workflows/linting.yml)
19+
[![Code Style Ruff](https://img.shields.io/badge/Code%20Style-Ruff-brightgreen?style=flat-square&logo=ruff)](https://github.com/astral-sh/ruff)
20+
[![GitHub License](https://img.shields.io/github/license/mlcommons/algorithmic-efficiency?style=flat-square&label=License)](LICENSE.md)
21+
[![Discord](https://dcbadge.limes.pink/api/server/5FPXK7SMt6?style=flat-square)](https://discord.gg/5FPXK7SMt6)
2222

2323
---
2424

@@ -28,11 +28,12 @@ Submissions are evaluated based on their "time-to-result", i.e., the wall-clock
2828

2929
---
3030

31-
> This is the repository for the *AlgoPerf: Training Algorithms benchmark* measuring neural network training speedups due to algorithmic improvements.
31+
> This is the repository for the _AlgoPerf: Training Algorithms benchmark_ measuring neural network training speedups due to algorithmic improvements.
3232
> It is developed by the [MLCommons Algorithms Working Group](https://mlcommons.org/en/groups/research-algorithms/).
3333
> This repository holds the benchmark code, the benchmark's [**technical documentation**](/docs/DOCUMENTATION.md) and [**getting started guides**](/docs/GETTING_STARTED.md). For a detailed description of the benchmark design, see our [**introductory paper**](https://arxiv.org/abs/2306.07179), for the results of the inaugural competition see our [**results paper**](https://openreview.net/forum?id=CtM5xjRSfm).
3434
>
3535
> **See our [AlgoPerf Leaderboard](https://github.com/mlcommons/submissions_algorithms) for the latest results of the benchmark and to submit your algorithm.**
36+
3637
---
3738

3839
> [!IMPORTANT]
@@ -50,22 +51,21 @@ Submissions are evaluated based on their "time-to-result", i.e., the wall-clock
5051

5152
## Installation
5253

53-
> [!TIP]
54-
> **If you have any questions about the benchmark competition or you run into any issues, please feel free to contact us.** Either [file an issue](https://github.com/mlcommons/algorithmic-efficiency/issues), ask a question on [our Discord](https://discord.gg/5FPXK7SMt6) or [join our weekly meetings](https://mlcommons.org/en/groups/research-algorithms/).
54+
> [!TIP] > **If you have any questions about the benchmark competition or you run into any issues, please feel free to contact us.** Either [file an issue](https://github.com/mlcommons/algorithmic-efficiency/issues), ask a question on [our Discord](https://discord.gg/5FPXK7SMt6) or [join our weekly meetings](https://mlcommons.org/en/groups/research-algorithms/).
5555
5656
You can install this package and dependencies in a [Python virtual environment](/docs/GETTING_STARTED.md#python-virtual-environment) or use a [Docker/Singularity/Apptainer container](/docs/GETTING_STARTED.md#docker) (recommended).
5757
We recommend using a Docker container (or alternatively, a Singularity/Apptainer container) to ensure a similar environment to our scoring and testing environments.
5858
Both options are described in detail in the [**Getting Started**](/docs/GETTING_STARTED.md) document.
5959

60-
*TL;DR to install the Jax version for GPU run:*
60+
_TL;DR to install the Jax version for GPU run:_
6161

6262
```bash
6363
pip3 install -e '.[pytorch_cpu]'
6464
pip3 install -e '.[jax_gpu]' -f 'https://storage.googleapis.com/jax-releases/jax_cuda_releases.html'
6565
pip3 install -e '.[full]'
6666
```
6767

68-
*TL;DR to install the PyTorch version for GPU run:*
68+
_TL;DR to install the PyTorch version for GPU run:_
6969

7070
```bash
7171
pip3 install -e '.[jax_cpu]'
@@ -77,7 +77,7 @@ pip3 install -e '.[full]'
7777

7878
For detailed instructions on developing your own algorithm in the benchmark see the [Getting Started](/docs/GETTING_STARTED.md) document.
7979

80-
*TL;DR running a JAX workload:*
80+
_TL;DR running a JAX workload:_
8181

8282
```bash
8383
python3 submission_runner.py \
@@ -89,7 +89,7 @@ python3 submission_runner.py \
8989
--tuning_search_space=reference_algorithms/paper_baselines/adamw/tuning_search_space.json
9090
```
9191

92-
*TL;DR running a PyTorch workload:*
92+
_TL;DR running a PyTorch workload:_
9393

9494
```bash
9595
python3 submission_runner.py \
@@ -117,17 +117,15 @@ Our [**Contributing**](/docs/CONTRIBUTING.md) document provides further MLCommon
117117

118118
## License
119119

120-
The *AlgoPerf* codebase is licensed under the [Apache License 2.0](/LICENSE.md).
120+
The _AlgoPerf_ codebase is licensed under the [Apache License 2.0](/LICENSE.md).
121121

122122
## Paper and Citing the AlgoPerf Benchmark
123123

124-
In our paper ["Benchmarking Neural Network Training Algorithms"](http://arxiv.org/abs/2306.07179) we motivate, describe, and justify the *AlgoPerf: Training Algorithms* benchmark.
124+
In our paper ["Benchmarking Neural Network Training Algorithms"](http://arxiv.org/abs/2306.07179) we motivate, describe, and justify the _AlgoPerf: Training Algorithms_ benchmark.
125125

126-
If you are using the *AlgoPerf benchmark*, its codebase, baselines, or workloads, please consider citing our paper:
126+
If you are using the _AlgoPerf benchmark_, its codebase, baselines, or workloads, please consider citing our paper:
127127

128-
> [Dahl, Schneider, Nado, et al.<br/>
129-
> **Benchmarking Neural Network Training Algorithms**<br/>
130-
> *arXiv 2306.07179*](http://arxiv.org/abs/2306.07179)
128+
> [Dahl, Schneider, Nado, et al.<br/> > **Benchmarking Neural Network Training Algorithms**<br/> > _arXiv 2306.07179_](http://arxiv.org/abs/2306.07179)
131129
132130
```bibtex
133131
@Misc{Dahl2023AlgoPerf,
@@ -139,10 +137,9 @@ If you are using the *AlgoPerf benchmark*, its codebase, baselines, or workloads
139137
}
140138
```
141139

142-
If you use the results from the first *AlgoPerf competition*, please consider citing the results paper, as well as the relevant submissions:
140+
If you use the results from the first _AlgoPerf competition_, please consider citing the results paper, as well as the relevant submissions:
143141

144-
> [Kasimbeg, Schneider, Eschenhagen, et al.<br/>
145-
> **Accelerating neural network training: An analysis of the AlgoPerf competition**<br/>
142+
> [Kasimbeg, Schneider, Eschenhagen, et al.<br/> > **Accelerating neural network training: An analysis of the AlgoPerf competition**<br/>
146143
> ICLR 2025](https://openreview.net/forum?id=CtM5xjRSfm)
147144
148145
```bibtex

algoperf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from ._version import version as __version__
44

5-
__all__ = ["__version__"]
5+
__all__ = ['__version__']

0 commit comments

Comments
 (0)