Skip to content

Commit cd5b2d4

Browse files
author
Florian Sestak
committed
Commit train code
1 parent f526c01 commit cd5b2d4

File tree

146 files changed

+16871
-0
lines changed

Some content is hidden

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

146 files changed

+16871
-0
lines changed

.env.example

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# example of file for storing private and user specific environment variables, like keys or system paths
2+
# rename it to ".env" (excluded from version control by default)
3+
# .env is loaded by train.py automatically
4+
# hydra allows you to reference variables in .yaml configs with special syntax: ${oc.env:MY_VAR}
5+
6+
MY_VAR="/home/user/my/system/path"
7+
CONDA_ENV="pyt25" # path to conda environment, relevant for training on cluster with slurm (e.g. configs/meluxina.yaml)
8+
SLURM_ACCOUNT="my_account" # account for slurm, relevant for training on cluster with slurm (e.g. configs/meluxina.yaml)
9+
WANDB_BASE_URL=""
10+
WANDB_ENTITY=""
11+
WANDB_BASE_URL=https://api.wandb.ai
12+
WANDB_IGNORE_GLOBS=*.log # We ignore to upload the log files to wandb, this fills up the space fast.

.gitignore

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.venv
106+
env/
107+
venv/
108+
ENV/
109+
env.bak/
110+
venv.bak/
111+
112+
# Spyder project settings
113+
.spyderproject
114+
.spyproject
115+
116+
# Rope project settings
117+
.ropeproject
118+
119+
# mkdocs documentation
120+
/site
121+
122+
# mypy
123+
.mypy_cache/
124+
.dmypy.json
125+
dmypy.json
126+
127+
# Pyre type checker
128+
.pyre/
129+
130+
### VisualStudioCode
131+
.vscode/*
132+
!.vscode/settings.json
133+
!.vscode/tasks.json
134+
!.vscode/launch.json
135+
!.vscode/extensions.json
136+
*.code-workspace
137+
**/.vscode
138+
139+
# JetBrains
140+
.idea/
141+
142+
# Data & Models
143+
*.h5
144+
*.tar
145+
*.tar.gz
146+
147+
# Lightning-Hydra-Template
148+
configs/local/default.yaml
149+
/data/
150+
/logs/
151+
.env
152+
153+
# Aim logging
154+
.aim
155+
wandb/*
156+
157+
/data/*
158+
/data
159+
exports/*
160+
/exports
161+
hpc_ckpts/*
162+
/hpc_ckpts
163+
ckpts/*
164+
/ckpts
165+
166+
lightning_logs/*

.pre-commit-config.yaml

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
default_language_version:
2+
python: python3
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v5.0.0
7+
hooks:
8+
# list of supported hooks: https://pre-commit.com/hooks.html
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: check-docstring-first
12+
- id: check-yaml
13+
- id: debug-statements
14+
- id: detect-private-key
15+
- id: check-executables-have-shebangs
16+
- id: check-toml
17+
- id: check-case-conflict
18+
- id: check-added-large-files
19+
20+
# python code formatting
21+
- repo: https://github.com/psf/black
22+
rev: 24.10.0
23+
hooks:
24+
- id: black
25+
args: [--line-length, "99"]
26+
27+
# python import sorting
28+
- repo: https://github.com/PyCQA/isort
29+
rev: 5.13.2
30+
hooks:
31+
- id: isort
32+
args: ["--profile", "black", "--filter-files"]
33+
34+
# python upgrading syntax to newer version
35+
- repo: https://github.com/asottile/pyupgrade
36+
rev: v3.19.0
37+
hooks:
38+
- id: pyupgrade
39+
args: [--py38-plus]
40+
41+
# python docstring formatting
42+
- repo: https://github.com/PyCQA/docformatter
43+
rev: v1.7.4
44+
hooks:
45+
- id: docformatter
46+
args:
47+
[
48+
--in-place,
49+
--wrap-summaries=99,
50+
--wrap-descriptions=99,
51+
--style=sphinx,
52+
--black,
53+
]
54+
language: python
55+
types: [python]
56+
57+
# python docstring coverage checking
58+
- repo: https://github.com/econchick/interrogate
59+
rev: 1.7.0 # or master if you're bold
60+
hooks:
61+
- id: interrogate
62+
args:
63+
[
64+
--verbose,
65+
--fail-under=80,
66+
--ignore-init-module,
67+
--ignore-init-method,
68+
--ignore-module,
69+
--ignore-nested-functions,
70+
-vv,
71+
]
72+
73+
# python check (PEP8), programming errors and code complexity
74+
- repo: https://github.com/PyCQA/flake8
75+
rev: 7.1.1
76+
hooks:
77+
- id: flake8
78+
args:
79+
[
80+
"--extend-ignore",
81+
"E203,E402,E501,F401,E731,F841,RST2,RST301",
82+
"--exclude",
83+
"logs/*,data/*",
84+
]
85+
additional_dependencies: [flake8-rst-docstrings==0.3.0]
86+
87+
# python security linter
88+
# - repo: https://github.com/PyCQA/bandit
89+
# rev: "1.7.10"
90+
# hooks:
91+
# - id: bandit
92+
# args: ["-s", "B101"]
93+
94+
# yaml formatting
95+
- repo: https://github.com/pre-commit/mirrors-prettier
96+
rev: v3.0.0-alpha.6
97+
hooks:
98+
- id: prettier
99+
types: [yaml]
100+
exclude: "environment.yaml"
101+
102+
# shell scripts linter
103+
- repo: https://github.com/shellcheck-py/shellcheck-py
104+
rev: v0.10.0.1
105+
hooks:
106+
- id: shellcheck
107+
108+
# md formatting
109+
- repo: https://github.com/executablebooks/mdformat
110+
rev: 0.7.18
111+
hooks:
112+
- id: mdformat
113+
args: ["--number"]
114+
additional_dependencies:
115+
- mdformat-gfm
116+
- mdformat-tables
117+
- mdformat_frontmatter
118+
# - mdformat-toc
119+
# - mdformat-black
120+
121+
# word spelling linter
122+
- repo: https://github.com/codespell-project/codespell
123+
rev: v2.3.0
124+
hooks:
125+
- id: codespell
126+
args:
127+
- --skip=logs/**,data/**,*.ipynb
128+
- --ignore-words-list=OT,ot
129+
130+
# jupyter notebook cell output clearing
131+
- repo: https://github.com/kynan/nbstripout
132+
rev: 0.7.1
133+
hooks:
134+
- id: nbstripout
135+
136+
# jupyter notebook linting
137+
- repo: https://github.com/nbQA-dev/nbQA
138+
rev: 1.8.7
139+
hooks:
140+
- id: nbqa-black
141+
args: ["--line-length=99"]
142+
- id: nbqa-isort
143+
args: ["--profile=black"]
144+
- id: nbqa-flake8
145+
args:
146+
[
147+
"--extend-ignore=E203,E402,E501,E731,F401,F841",
148+
"--exclude=logs/*,data/*",
149+
]
150+
151+
# - repo: https://github.com/PyCQA/autoflake
152+
# rev: v2.3.1
153+
# hooks:
154+
# - id: autoflake
155+
156+
# mypy
157+
# - repo: https://github.com/pre-commit/mirrors-mypy
158+
# rev: v1.6.1
159+
# hooks:
160+
# - id: mypy
161+
162+
# remove unused imports and variables
163+
- repo: https://github.com/PyCQA/autoflake
164+
rev: v2.3.1
165+
hooks:
166+
- id: autoflake
167+
args:
168+
[
169+
"--in-place",
170+
"--remove-all-unused-imports",
171+
"--ignore-init-module-imports",
172+
]

.project-root

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# this file is required for inferring the project root directory
2+
# do not delete

Makefile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
help: ## Show help
3+
@grep -E '^[.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
4+
5+
clean: ## Clean autogenerated files
6+
rm -rf dist
7+
find . -type f -name "*.DS_Store" -ls -delete
8+
find . | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -rf
9+
find . | grep -E ".pytest_cache" | xargs rm -rf
10+
find . | grep -E ".ipynb_checkpoints" | xargs rm -rf
11+
rm -f .coverage
12+
13+
clean-logs: ## Clean logs
14+
rm -rf logs/**
15+
16+
format: ## Run pre-commit hooks
17+
pre-commit run -a
18+
19+
sync: ## Merge changes from main branch to your current branch
20+
git pull
21+
git pull origin main
22+
23+
train: ## Train the model
24+
python src/train.py

0 commit comments

Comments
 (0)