Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmukadam authored and luisenp committed Dec 3, 2021
0 parents commit cc7d4e7
Show file tree
Hide file tree
Showing 141 changed files with 14,345 additions and 0 deletions.
109 changes: 109 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
version: 2.1


# -------------------------------------------------------------------------------------
# Executors
# -------------------------------------------------------------------------------------
executors:
gpu:
environment:
CUDA_VERSION: "10.2"
PYTHONUNBUFFERED: 1
machine:
image: ubuntu-1604:201903-01
resource_class: gpu.medium # tesla m60

# -------------------------------------------------------------------------------------
# Re-usable commands
# -------------------------------------------------------------------------------------
install_nox: &install_nox
- run:
name: "Preparing environment"
command: |
sudo apt-get install -y expect
sudo pip install nox==2020.8.22
install_suitesparse: &install_suitesparse
- run:
name: "Preparing environment"
command: |
sudo apt-get install -y libsuitesparse-dev
setupcuda: &setupcuda
- run:
name: Setup CUDA
working_directory: ~/
command: |
# download and install nvidia drivers, cuda, etc
wget --quiet --no-clobber -P ~/nvidia-downloads 'https://s3.amazonaws.com/ossci-linux/nvidia_driver/NVIDIA-Linux-x86_64-440.82.run'
time sudo /bin/bash ~/nvidia-downloads/NVIDIA-Linux-x86_64-440.82.run --no-drm -q --ui=none
echo "Done installing NVIDIA drivers."
pyenv versions
nvidia-smi
pyenv global 3.7.0
# -------------------------------------------------------------------------------------
# Jobs
# -------------------------------------------------------------------------------------
jobs:
py37_linux:
docker:
- image: circleci/python:3.7
steps:
- checkout
- <<: *install_suitesparse
- <<: *install_nox
- run:
name: "Testing theseus"
command: |
export NOX_PYTHON_VERSIONS=3.7
pip install nox==2020.8.22
nox
py38_linux:
docker:
- image: circleci/python:3.8
steps:
- checkout
- <<: *install_suitesparse
- <<: *install_nox
- run:
name: "Testing theseus"
command: |
export NOX_PYTHON_VERSIONS=3.8
pip install nox==2020.8.22
nox
unittests_gpu17:
executor: gpu
steps:
- checkout
- <<: *install_suitesparse
- <<: *setupcuda
- run:
name: Installs basic dependencies
command: |
pyenv versions
pyenv global 3.7.0
python -m venv ~/theseus_venv
echo ". ~/theseus_venv/bin/activate" >> $BASH_ENV
. ~/theseus_venv/bin/activate
pip install --progress-bar off --upgrade pip
pip install --progress-bar off --upgrade setuptools
pip install --progress-bar off torch==1.9.0+cu102 torchvision torchaudio -f https://download.pytorch.org/whl/torch_stable.html
python -c 'import torch; print("Torch version:", torch.__version__); assert torch.cuda.is_available()'
pip install --progress-bar off -e .
install_cuda: true
- run:
name: Run GPU tests
command: |
pytest theseus/tests/test_theseus_layer.py -s
workflows:
version: 2
build:
jobs:
- py37_linux
- py38_linux
- unittests_gpu17
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "\U0001F41B Bug Report"
about: Submit a bug report to help us improve Theseus
---

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## Steps to Reproduce

Steps to reproduce the behavior:

<!-- If you were running a command, post the exact command that you were running -->
<!-- Please note that without a minimal working example to reproduce the bug, we may not be able to help. -->
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Additional context

<!-- Add any other context about the problem here. -->

## System Info

<!-- Please fill out the checklist below. -->
- OS (e.g., Linux):
- Python version:
- GPU models and configuration:
- CUDA version:
- pip/conda dependencies packages versions:
- Any other relevant information:
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "\U0001F680 Feature Request"
about: Submit a proposal or request for a new Theseus feature
---

## 🚀 Feature
<!-- A clear and concise description of the feature proposal. -->

## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request related to -->
<!-- a problem? e.g., I'm always frustrated when [...]. If this is related to another -->
<!-- GitHub issue, please link here too. -->

## Pitch

<!-- A clear and concise description of what you want to happen. -->

## Alternatives

<!-- A clear and concise description of any alternative solutions or features you've -->
<!-- considered, if any. -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/QUESTIONS_HELP_SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: "❓ Questions/Help/Support"
about: Do you need support?
---

## ❓ Questions and Help
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
<!--- Please link to an existing issue here if one exists. -->
<!--- (we recommend to have an existing issue for each pull request) -->

## How Has This Been Tested

<!--- Please describe here how your modifications have been tested. -->

## Types of changes

<!-- What types of changes does your code introduce? -->
<!-- Put an `x` in all the boxes that apply: -->
- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have completed my CLA (see **CONTRIBUTING**)
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.idea
.DS_Store
.vscode
*.code-workspace
build/
.mypy_cache/
.pytest_cache/
__pycache__/
*.egg-info/
expts/
*.ipynb_checkpoints
examples/*.ipynb_checkpoints
outputs/
examples/outputs/
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
language_version: python3.7

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies: [-e, "git+git://github.com/pycqa/pyflakes.git@1911c20#egg=pyflakes"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
additional_dependencies: [torch==1.9.0, tokenize-rt==3.2.0, types-PyYAML]
args: [--no-strict-optional, --ignore-missing-imports]
exclude: setup.py

- repo: https://github.com/pycqa/isort
rev: 5.6.4
hooks:
- id: isort
files: 'theseus/.*'
80 changes: 80 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

This Code of Conduct also applies outside the project spaces when there is a
reasonable belief that an individual's behavior may have a negative impact on
the project or its community.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <[email protected]>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
56 changes: 56 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Contributing to Theseus

We want to make contributing to Theseus as easy and transparent as possible.

### Developer Guide

- Fork the repo and make a branch from `develop`. See the hybrid [workflow model](#workflow-model) we follow.
```bash
git checkout -b <username>.<appropriate_branch_name> develop
````
- Make small, independent, and well documented commits. If you've changed APIs, update the documentation. Add or modify unit tests as appropriate. Follow this [code style](#code-style).
- See [pull requests](#pull-requests) guide when you are ready to have your code reviewed to be merged into `develop`. It will be included in the next release on `main` following this [versioning](#versioning).
- See [issues](#issues) for questions, suggestions, and bugs.
- If you haven't already, complete the [Contributor License Agreement](#contributor-license-agreement) and see [license](#license).

---

## Workflow Model

We follow a hyrbid between [Gitflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) and [Trunk-based](https://www.atlassian.com/continuous-delivery/continuous-integration/trunk-based-development) models. From the former we adopt hosting latest stable release on `main` branch and feature development on `develop` branch, and from the latter we adopt small and frequent merges of new features into `develop`.

## Code Style

For Python we use `black` and `isort` for linting and code style, and use [typing](https://docs.python.org/3/library/typing.html). We also use pre-commit hooks to ensure linting and style enforcement.
```bash
pip install pre-commit && pre-commit install && pre-commit run --all-files
```

## Pull Requests

- We encourage more smaller and focused PRs rather than big PRs with many independent changes.
- Use this [PR template](.github/PULL_REQUEST_TEMPLATE.md) to submit your code for review. Consider using the [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/) option to gather early feedback.
- Add yourself to the `Assignees`, add at least one core Theseus team member to `Reviewers`, link to any open issues that can be closed when the PR is merged, and add appropriate `Labels` and `Milestone`.
- We expect the PR is ready for final review only if Continuous Integration tests are passing.
- Keep your branch up-to-date with `develop` by rebasing as necessary.
- We employ `squash-and-merge` for incorporating PRs. Add a brief change summary to the commit message.
- After PR is approved and merged into `develop`, delete the branch to reduce clutter.

## Versioning

We use [semantic versioning](https://semver.org/). For core Theseus team member, to prepare a release:
- Update [version](version.txt) file.
- Make sure all tests are passing.
- Create a release tag with changelog summary using the github release interface.

## Issues

We use [GitHub issues](https://github.com/facebookresearch/theseus/issues) to track bugs. You can also reach out to us there with questions or suggestions. Please ensure your description is clear by following our [templates](https://github.com/facebookresearch/theseus/issues/new/choose).

## Contributor License Agreement

In order to accept your pull request, we need you to submit a Contributor License Agreement (CLA). You only need to do this once to work on any of Meta's open source projects. Complete your CLA here: <https://code.facebook.com/cla>
## License
By contributing to Theseus, you agree that your contributions will be licensed under the [LICENSE](LICENSE) file in the root directory of this source tree.
Loading

0 comments on commit cc7d4e7

Please sign in to comment.