Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanwebb committed Oct 31, 2021
0 parents commit e39ecda
Show file tree
Hide file tree
Showing 165 changed files with 28,395 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Issue Description
A clear and concise description of the issue. If it's a feature request, please add [Feature Request] to the title.

### Steps to Reproduce
Please provide steps to reproduce the issue attaching any error messages and stack traces.

### Expected Behavior
What did you expect to happen?

### System Info
Please provide information about your setup
- PyTorch Version (run `print(torch.__version__)`
- Python version

### Additional Context
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### Motivation
Please describe your motivation for the changes. Provide link to any related issues.

### Changes proposed
Outline the proposed changes and alternatives considered.

### Test Plan
Please provide clear instructions on how the changes were verified. Attach screenshots if applicable.

### Types of changes
- [ ] 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
- [ ] 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](https://github.com/facebookincubator/flowtorch/blob/main/CONTRIBUTING.md)** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] The title of my pull request is a short description of the requested changes.
72 changes: 72 additions & 0 deletions .github/workflows/deploy-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Deploy On Release

on:
release:
types: [created]

jobs:
tests-and-coverage-pip:
name: Tests and coverage (pip, Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ['3.7', '3.8', '3.9']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install (auto-install dependencies)
run: |
python -m pip install --upgrade pip
pip install -e .[test]
- name: Test with pytest
run: |
pytest --cov=tests --cov-report=xml -W ignore::DeprecationWarning tests/
- name: Upload coverage to Codecov
if: ${{ runner.os == 'Linux' && matrix.python-version == 3.7 }}
uses: codecov/codecov-action@v1
with:
token: 9667eb01-c300-4166-b8ba-605deb2682e4
files: coverage.xml
directory: ./
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./codecov_report.txt
verbose: true

release-pypi:
name: Release to pypi.org
runs-on: ubuntu-latest
needs: tests-and-coverage-pip
strategy:
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install packaging dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
- name: Build source distribution
run: python setup.py sdist bdist_wheel
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
# swap for test PyPI
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
67 changes: 67 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: documentation

on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
checks:
if: github.event_name != 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/setup-node@v2
with:
node-version: '12.x'
- name: Test Build
working-directory: ./website
run: |
python -m pip install --upgrade pip
pip install -e ..
python ../scripts/generate_api_docs.py
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
gh-release:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/setup-node@v2
with:
node-version: '12.x'
- uses: webfactory/ssh-agent@v0.5.0
with:
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
working-directory: ./website
run: |
git config --global user.email "feynmanl@fb.com"
git config --global user.name "Feynman Liang"
python -m pip install --upgrade pip
pip install -e ..
python ../scripts/generate_api_docs.py
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run deploy
61 changes: 61 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
tests-and-coverage-pip:
name: Tests and coverage (pip, Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ['3.7', '3.8', '3.9']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Check copyright headers
run: |
python scripts/copyright_headers.py --check flowtorch tests scripts examples
- name: Check formatting with black
run: |
black --check flowtorch tests scripts examples
- name: Check imports with usort
run: |
usort check flowtorch tests scripts examples
- name: Lint with flake8
run: |
flake8 . --count --show-source --statistics
- name: Check types with mypy
run: |
mypy --disallow-untyped-defs flowtorch
- name: Test with pytest
run: |
pytest --cov=tests --cov-report=xml -W ignore::DeprecationWarning tests/
- name: Upload coverage to Codecov
if: ${{ runner.os == 'Linux' && matrix.python-version == 3.7 }}
uses: codecov/codecov-action@v1
with:
token: 9667eb01-c300-4166-b8ba-605deb2682e4
files: coverage.xml
directory: ./
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./codecov_report.txt
verbose: true
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
flowtorch.egg-info
flowtorch/version.py
*.pyc
.ipynb_checkpoints/
docs/_build/
debug/.vscode
debug/*.svg
build/
dist/
.eggs/
coverage.xml
.mypy_cache/
.vscode/
/.coverage
24 changes: 24 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements.txt
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0.3 (September 15, 2021)

* Deferred initialization of `Bijector`s and `Parameters` is expressed using the `flowtorch.LazyMeta` metaclass
* AffineAutoregressive can operate on inputs with arbitrary `event_shape`s
* A few cosmetic changes like changing `flowtorch.params.*` to `flowtorch.parameters.*`
* Temporarily removed conditional bijectors/transformed distributions and inverting bijectors
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 <opensource-conduct@fb.com>. 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
Loading

0 comments on commit e39ecda

Please sign in to comment.