Kernels
TaehyunKimMotif commited on
Commit
80187d6
·
1 Parent(s): 15b5d41

add pre commit action w/o pre-commit applied

Browse files
.github/workflows/pre-commit.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [ main, master ]
7
+
8
+ jobs:
9
+ run-pre-commit:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ pull-requests: read
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.11"
20
+
21
+ - name: Cache pre-commit
22
+ uses: actions/cache@v4
23
+ with:
24
+ path: ~/.cache/pre-commit
25
+ key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
26
+ restore-keys: |
27
+ pre-commit-${{ runner.os }}-
28
+
29
+ - name: Run pre-commit
30
+ uses: pre-commit/[email protected]
.pre-commit-config.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ default_install_hook_types:
2
+ - pre-commit
3
+ - commit-msg
4
+ default_stages:
5
+ - pre-commit # Run locally
6
+ - manual # Run in CI
7
+ exclude: '(build|result)/.*'
8
+ repos:
9
+ - repo: https://github.com/google/yapf
10
+ rev: v0.43.0
11
+ hooks:
12
+ - id: yapf
13
+ args: [--in-place, --verbose]
14
+ - repo: https://github.com/crate-ci/typos
15
+ rev: v1.34.0
16
+ hooks:
17
+ - id: typos
18
+ - repo: https://github.com/PyCQA/isort
19
+ rev: 6.0.1
20
+ hooks:
21
+ - id: isort
22
+ - repo: https://github.com/pre-commit/mirrors-clang-format
23
+ rev: v20.1.3
24
+ hooks:
25
+ - id: clang-format
26
+ types_or: [c++, cuda]
27
+ args: [--style=file, --verbose]
28
+ - repo: https://github.com/jackdewinter/pymarkdown
29
+ rev: v0.9.29
30
+ hooks:
31
+ - id: pymarkdown
32
+ args: [fix]
33
+ - repo: https://github.com/rhysd/actionlint
34
+ rev: v1.7.7
35
+ hooks:
36
+ - id: actionlint
README.md CHANGED
@@ -10,7 +10,7 @@ Optimizer is a python package that provides:
10
  - PyTorch implementation of recent optimizer algorithms
11
  - with support for parallelism techniques for efficient large-scale training.
12
 
13
- ### Currently implemented
14
  - [Parallel Muon with FSDP2](./docs/muon/parallel_muon.pdf)
15
 
16
  ## Usage
@@ -31,4 +31,49 @@ optim = optimizer.Muon(
31
  momentum=0.9,
32
  weight_decay=1e-4,
33
  )
34
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  - PyTorch implementation of recent optimizer algorithms
11
  - with support for parallelism techniques for efficient large-scale training.
12
 
13
+ ## Currently implemented
14
  - [Parallel Muon with FSDP2](./docs/muon/parallel_muon.pdf)
15
 
16
  ## Usage
 
31
  momentum=0.9,
32
  weight_decay=1e-4,
33
  )
34
+ ```
35
+
36
+ ## Pre-commit Hooks
37
+
38
+ This project uses [pre-commit](https://pre-commit.com/) to automatically check and format code before commits.
39
+
40
+ ### Setup
41
+
42
+ 1. Install pre-commit:
43
+
44
+ ```bash
45
+ pip install pre-commit
46
+ ```
47
+
48
+ 2. Install the git hooks:
49
+
50
+ ```bash
51
+ pre-commit install
52
+ ```
53
+
54
+ Once installed, the configured hooks will run automatically on each commit.
55
+
56
+ ### Included Hooks
57
+
58
+ The following tools are run via pre-commit:
59
+
60
+ - **[yapf](https://github.com/google/yapf)** – Python code formatter
61
+ - **[typos](https://github.com/crate-ci/typos)** – Spell checker for common typos
62
+ - **[isort](https://github.com/PyCQA/isort)** – Organizes and sorts Python imports
63
+ - **[clang-format](https://clang.llvm.org/docs/ClangFormat.html)** – Formats C++/CUDA code (`--style=file`)
64
+ - **[pymarkdown](https://github.com/jackdewinter/pymarkdown)** – Lints and auto-fixes Markdown files
65
+ - **[actionlint](https://github.com/rhysd/actionlint)** – Validates GitHub Actions workflows
66
+
67
+ ### Usage
68
+
69
+ - Run all checks on the entire codebase:
70
+
71
+ ```bash
72
+ pre-commit run --all-files
73
+ ```
74
+
75
+ - Run a specific hook (example: isort):
76
+
77
+ ```bash
78
+ pre-commit run isort --all-files
79
+ ```