Skip to content

Commit

Permalink
🎉 first commit
Browse files Browse the repository at this point in the history
simonmeoni committed Jun 4, 2023
0 parents commit 8f3224f
Showing 91 changed files with 6,171 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
max-line-length = 100
extend-ignore = E203
per-file-ignores = **/__init__.py:F401
exclude =
.git,
__pycache__,
build,
dist,
150 changes: 150 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
### Custom .gitignore ###
# Data stuff
*/*/data

# IDE stuff
.idea/
.vscode/

### GitHub's .gitignore Python template ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
datasets/*/data
datasets/**/resources
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

#logs

/**/**/outputs
/**/**/wandb
/**/logs/**
/**/multirun

#custom extension
*.bak
**/e3c_llm/data/*
68 changes: 68 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This file defines all the hooks run by pre-commit.

exclude: "poetry.lock"

repos:
# Base pre-commit hook repository, for simple checks & fixes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files # Prevent giant files from being committed
- id: check-ast # Check whether the files parse as valid Python
- id: check-json # Check JSON files for parseable syntax
- id: check-merge-conflict # Check for files that contain merge conflict strings
- id: check-toml # Checks TOML files for parseable syntax
- id: check-yaml # Check YAML files for parseable syntax
- id: debug-statements # Check for debugger imports and `breakpoint()` calls in python
- id: detect-private-key # Detect the presence of private keys
- id: end-of-file-fixer # Ensures that files end with a newline
- id: name-tests-test # Verify that test files are named correctly
exclude: tests/utils/

# Black is used to format the code in Python
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black

# Isort is used to re-organize our import statements in Python
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--resolve-all-configs"]

# nbstripout is used to remove Jupyter notebooks' cell outputs
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout

# Prettier is a formatting tool for many non-Python files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
hooks:
- id: prettier

# TOML-sort is used to re-organize alphabetically TOML files (such as pyproject.toml)
- repo: https://github.com/pappasam/toml-sort
rev: v0.22.1
hooks:
- id: toml-sort
args: ["--all", "--in-place"]

# Flake8 is used to perform various code sanity checks in Python
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
exclude: notebooks/

# Mypy is used to check the typing hints in Python; it is quite a restrictive tool, so we don't
# use it in tests
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
- id: mypy
exclude: apps/|notebooks/|tests/
additional_dependencies: ["types-requests"]
2 changes: 2 additions & 0 deletions .project-root
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# this file is required for inferring the project root directory
# do not delete
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Build: sudo docker build -t <project_name> .
# Run: sudo docker run -v $(pwd):/workspace/project --gpus all -it --rm <project_name>


FROM nvidia/cuda:12.0.0-devel-ubuntu20.04


ENV CONDA_ENV_NAME=myenv
ENV PYTHON_VERSION=3.9


# Basic setup
RUN apt update
RUN apt install -y zsh \
build-essential \
git \
curl \
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true

# Set working directory
WORKDIR /workspace/project


# Install Miniconda and create main env
ADD https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh miniconda3.sh
RUN bash miniconda3.sh -b -p /conda \
&& echo export PATH=/conda/bin:$PATH >> .zshrc \
&& rm miniconda3.sh
ENV PATH="/conda/bin:${PATH}"
RUN conda create -n ${CONDA_ENV_NAME} python=${PYTHON_VERSION}


# Switch to zsh shell
SHELL ["/bin/zsh", "-c"]


# Install requirements
COPY pyproject.toml ./
RUN source activate ${CONDA_ENV_NAME} \
&& pip install poetry \
&& poetry install


# Set ${CONDA_ENV_NAME} to default virutal environment
RUN echo "source activate ${CONDA_ENV_NAME}" >> ~/.zshrc
Loading

0 comments on commit 8f3224f

Please sign in to comment.