Skip to content

Commit a75de0a

Browse files
committed
release ready; port to omegaconf
1 parent 9d87e19 commit a75de0a

36 files changed

Lines changed: 965 additions & 353 deletions

.github/workflows/pre-commit.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# ref: https://github.com/pre-commit-ci-demo/demo/blob/main/.github/workflows/pre-commit.yml
2+
name: pre-commit
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
pre-commit:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-python@v2
16+
- uses: pre-commit/action@v2.0.0

.gitignore

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1+
data/
2+
pretrained_models/
13

2-
outputs/
4+
# Byte-compiled / optimized / DLL files
35
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# Distribution / packaging
10+
build/
11+
dist/
12+
*.egg-info/
13+
14+
# data
15+
data/
16+
17+
# logs
18+
logs/
19+
outputs/
420

21+
# env
22+
.env
23+
.autoenv

.pre-commit-config.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
default_language_version:
2+
python: python3
3+
4+
ci:
5+
autofix_prs: true
6+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions"
7+
autoupdate_schedule: quarterly
8+
9+
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.4.0
12+
hooks:
13+
# list of supported hooks: https://pre-commit.com/hooks.html
14+
- id: trailing-whitespace
15+
- id: end-of-file-fixer
16+
- id: check-yaml
17+
- id: check-case-conflict
18+
- id: debug-statements
19+
- id: detect-private-key
20+
- id: check-added-large-files
21+
args: ["--maxkb=500", "--enforce-all"]
22+
exclude: |
23+
(?x)^(
24+
)$
25+
26+
- repo: https://github.com/asottile/pyupgrade
27+
rev: v3.3.1
28+
hooks:
29+
- id: pyupgrade
30+
args: [--py37-plus]
31+
name: Upgrade code
32+
33+
# python formatting
34+
- repo: https://github.com/psf/black
35+
rev: 23.1.0
36+
hooks:
37+
- id: black
38+
name: Format code
39+
args: ["--line-length=120"]
40+
41+
- repo: https://github.com/hadialqattan/pycln
42+
rev: v2.1.3 # Possible releases: https://github.com/hadialqattan/pycln/releases
43+
hooks:
44+
- id: pycln
45+
args: [--all]
46+
47+
# ref: https://github.com/microsoft/vscode-isort]
48+
- repo: https://github.com/pycqa/isort
49+
rev: 5.12.0
50+
hooks:
51+
- id: isort
52+
name: isort (python)
53+
args: [--profile, "black"]
54+
55+
# python docstring formatting
56+
- repo: https://github.com/myint/docformatter
57+
rev: v1.5.1
58+
hooks:
59+
- id: docformatter
60+
args: [--in-place, --wrap-summaries, "99", --wrap-descriptions, "92"]
61+
62+
# yaml formatting
63+
- repo: https://github.com/pre-commit/mirrors-prettier
64+
rev: v3.0.0-alpha.4
65+
hooks:
66+
- id: prettier
67+
types: [yaml]
68+
69+
# markdown formatting
70+
- repo: https://github.com/executablebooks/mdformat
71+
rev: 0.7.16
72+
hooks:
73+
- id: mdformat
74+
additional_dependencies:
75+
- mdformat-gfm
76+
#- mdformat-black
77+
- mdformat_frontmatter
78+
exclude: CHANGELOG.md

.vscode/extensions.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
// List of extensions which should be recommended for users of this workspace.
5+
"recommendations": [
6+
"ms-python.python",
7+
"ms-azuretools.vscode-docker",
8+
"ms-vscode-remote.remote-containers",
9+
"ms-vscode-remote.remote-ssh",
10+
"ms-vscode-remote.remote-ssh-edit",
11+
"ms-vscode-remote.vscode-remote-extensionpack",
12+
"redhat.vscode-yaml",
13+
"yzhang.markdown-all-in-one",
14+
"TrungNgo.autoflake",
15+
"njpwerner.autodocstring",
16+
"jbockle.jbockle-format-files"
17+
],
18+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
19+
"unwantedRecommendations": []
20+
}

.vscode/launch.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python: Current File",
6+
"type": "python",
7+
"request": "launch",
8+
"program": "${file}",
9+
"console": "integratedTerminal",
10+
"justMyCode": true
11+
},
12+
{
13+
"name": "dmc_pretrain",
14+
"type": "python",
15+
"request": "launch",
16+
"program": "src/dmc_pretrain.py",
17+
"console": "integratedTerminal",
18+
"justMyCode": true,
19+
"args": [
20+
"base=configs/pretrain.yaml",
21+
"trainer.num_nodes=1",
22+
"trainer.devices=1",
23+
]
24+
},
25+
{
26+
"name": "dmc_downstream",
27+
"type": "python",
28+
"request": "launch",
29+
"program": "src/dmc_downstream.py",
30+
"console": "integratedTerminal",
31+
"justMyCode": true,
32+
"args": [
33+
"base=configs/downstream.yaml",
34+
"trainer.num_nodes=1",
35+
"trainer.devices=1",
36+
]
37+
},
38+
]
39+
}

.vscode/settings.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"editor.defaultFormatter": "ms-python.black-formatter",
3+
"editor.formatOnPaste": true,
4+
"editor.formatOnSave": true,
5+
"editor.codeActionsOnSave": {
6+
"source.organizeImports": true
7+
},
8+
"python.analysis.typeCheckingMode": "basic",
9+
"python.formatting.provider": "black",
10+
"python.formatting.blackArgs": [
11+
"--line-length",
12+
"120"
13+
],
14+
"python.linting.enabled": true,
15+
"python.linting.pylintEnabled": false,
16+
"python.linting.flake8Enabled": true,
17+
"python.linting.flake8Args": [
18+
"--max-line-length=120",
19+
],
20+
"python.testing.pytestArgs": [
21+
"tests"
22+
],
23+
"python.testing.unittestEnabled": false,
24+
"python.testing.pytestEnabled": true,
25+
"isort.args": [
26+
"--profile",
27+
"black"
28+
],
29+
}

CODE_OF_CONDUCT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns

LICENSE.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
MIT License
2+
3+
Copyright (c) Microsoft Corporation.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE
22+
23+
PACT borrows from the following external code:
24+
25+
- minGPT, located at /src/models/modules/minGPT.py
26+
27+
"""
28+
The MIT License (MIT) Copyright (c) 2020 Andrej Karpathy
29+
30+
Permission is hereby granted, free of charge, to any person obtaining a copy
31+
of this software and associated documentation files (the "Software"), to deal
32+
in the Software without restriction, including without limitation the rights
33+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34+
copies of the Software, and to permit persons to whom the Software is
35+
furnished to do so, subject to the following conditions:
36+
37+
The above copyright notice and this permission notice shall be included in all
38+
copies or substantial portions of the Software.
39+
40+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46+
SOFTWARE.
47+
"""

0 commit comments

Comments
 (0)