Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
fbshipit-source-id: f0a1066f07cf2ccd46c3e06003937406dc6fded4
  • Loading branch information
facebook-github-bot committed Apr 13, 2021
0 parents commit 4feccb6
Show file tree
Hide file tree
Showing 215 changed files with 25,704 additions and 0 deletions.
205 changes: 205 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

# -------------------------------------------------------------------------------------
# CircleCI configuration file.
# Specifies automated environment setup and tests.
#
# See https://circleci.com/docs/2.0/language-python/ for more details
# Available Machine Images:
# https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
# -------------------------------------------------------------------------------------

version: 2.1

# -------------------------------------------------------------------------------------
# Environments to run the jobs in
# -------------------------------------------------------------------------------------
cpu: &cpu
machine:
image: ubuntu-2004:202101-01

gpu: &gpu
environment:
CUDA_VERSION: "10.2"
resource_class: gpu.medium # tesla m60
machine:
image: ubuntu-2004:202101-01

setup_cuda: &setup_cuda
run:
name: Setup CUDA
working_directory: ~/
command: |
# download and install nvidia drivers, cuda, etc
wget --no-verbose --no-clobber -P ~/nvidia-downloads https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_460.32.03_linux.run
sudo sh ~/nvidia-downloads/cuda_11.2.2_460.32.03_linux.run --silent
echo "Done installing CUDA."
nvidia-smi
# -------------------------------------------------------------------------------------
# Re-usable commands
# -------------------------------------------------------------------------------------
install_conda: &install_conda
run:
name: Setup Conda
working_directory: ~/
command: |
curl --retry 3 -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh conda.sh -b -p $HOME/miniconda3
setup_ptv_conda: &setup_ptv_conda
run:
name: Setup Conda Environment
command: |
pyenv versions
export PATH="$HOME/miniconda3/bin:$PATH"
conda update -y conda
conda init bash
source ~/.bashrc
conda create --name pytorchvideo python=3.7.9
install_pytorch: &install_pytorch
- run:
name: Install Pytorch
command: |
export PATH="$HOME/miniconda3/bin:$PATH"
conda activate pytorchvideo
conda install pytorch=1.8.0 torchvision -c pytorch
python -c 'import torch; print(torch.__version__)'
python -c 'import torch; print("CUDA:", torch.cuda.is_available())'
python -c 'import torchvision; print(torchvision.__version__)'
install_pytorchvideo: &install_pytorchvideo
- run:
name: Install PyTorchVideo
command: |
export PATH="$HOME/miniconda3/bin:$PATH"
conda activate pytorchvideo
pip install -U --progress-bar off -e .[test]
python -c 'import pytorchvideo; print(pytorchvideo.__version__)'
build_wheels: &build_wheels
- run:
name: Install PyTorchVideo
command: |
export PATH="$HOME/miniconda3/bin:$PATH"
conda activate pytorchvideo
python setup.py sdist
export BUILD_NIGHTLY="1"
python setup.py sdist
run_unittests: &run_unittests
- run:
name: Run Unit Tests
command: |
export PATH="$HOME/miniconda3/bin:$PATH"
conda activate pytorchvideo
python -m unittest discover -v -s tests
run_unittests_with_coverage: &run_unittests_with_coverage
- run:
name: Run Unit Tests
command: |
export PATH="$HOME/miniconda3/bin:$PATH"
conda activate pytorchvideo
coverage run -m unittest discover -v -s tests
bash <(curl -s https://codecov.io/bash)
# -------------------------------------------------------------------------------------
# Jobs to run
# -------------------------------------------------------------------------------------
jobs:
cpu_tests:
<<: *cpu
working_directory: ~/pytorchvideo
steps:
- checkout
- <<: *install_conda
- <<: *setup_ptv_conda
- <<: *install_pytorch
- <<: *install_pytorchvideo
- <<: *build_wheels
- <<: *run_unittests_with_coverage
- store_artifacts:
path: ~/pytorchvideo/dist
- persist_to_workspace:
root: ~/pytorchvideo/dist
paths:
- "*"

gpu_tests:
working_directory: ~/pytorchvideo
<<: *gpu
steps:
- checkout
- <<: *setup_cuda
- <<: *install_conda
- <<: *setup_ptv_conda
- <<: *install_pytorch
- <<: *install_pytorchvideo
- <<: *run_unittests

upload_wheel:
docker:
- image: circleci/python:3.7
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_TOKEN
working_directory: ~/pytorchvideo
steps:
- checkout
- attach_workspace:
at: ~/workspace
- run:
command: |
# no commits in the last 25 hours
if [[ -z $(git log --since="25 hours ago") ]]; then
echo "No commits in the last day."
exit 0
fi
pip install --progress-bar off --user twine
for pkg in ~/workspace/*.tar.gz; do
if [[ "$pkg" == *"nightly"* ]];
then
twine upload --verbose --skip-existing --username __token__ --password $PTV_NIGHTLY_PYPI_TOKEN $pkg
else
twine upload --verbose --skip-existing --username __token__ --password $PTV_PYPI_TOKEN $pkg
fi
done
# -------------------------------------------------------------------------------------
# Workflows to launch
# -------------------------------------------------------------------------------------
workflows:
version: 2
regular_test:
jobs:
- cpu_tests:
context:
- DOCKERHUB_TOKEN
- gpu_tests:
context:
- DOCKERHUB_TOKEN

nightly:
jobs:
# https://circleci.com/docs/2.0/contexts/#creating-and-using-a-context
- cpu_tests:
context:
- DOCKERHUB_TOKEN
- gpu_tests:
context:
- DOCKERHUB_TOKEN
- upload_wheel:
requires:
- cpu_tests
- gpu_tests
context:
- DOCKERHUB_TOKEN
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
ignore = E203, E266, E501, W503, E221
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude = build,__init__.py
76 changes: 76 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# 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.

## 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
55 changes: 55 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing to PyTorchVIdeo
We want to make contributing to this project as easy and transparent as
possible.

## Pull Requests
We actively welcome your pull requests.

However, if you're adding any significant features, please make sure to have a corresponding issue to outline your proposal and motivation and allow time for us to give feedback, *before* you send a PR.
We do not always accept new features, and we take the following factors into consideration:

- Whether the same feature can be achieved without modifying PyTorchVideo directly. If any aspect of the API is not extensible, please highlight this in an issue so we can work on making this more extensible.
- Whether the feature is potentially useful to a large audience, or only to a small portion of users.
- Whether the proposed solution has a good design and interface.
- Whether the proposed solution adds extra mental/practical overhead to users who don't need such feature.
- Whether the proposed solution breaks existing APIs.

When sending a PR, please ensure you complete the following steps:

1. Fork the repo and create your branch from `master`. Follow the instructions
in [INSTALL.md](../INSTALL.md) to build the repo.
2. If you've added code that should be tested, add tests.
3. If you've changed any APIs, please update the documentation.
4. Ensure the test suite passes:
```
cd pytorchvideo/tests
python -m unittest -v
```
5. Make sure your code lints by running `dev/linter.sh` from the project root.
6. If a PR contains multiple orthogonal changes, split it into multiple separate PRs.
7. If you haven't already, complete the Contributor License Agreement ("CLA").
## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.
Complete your CLA here: <https://code.facebook.com/cla>
## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.
## Coding Style
We follow these [python](http://google.github.io/styleguide/pyguide.html) and [C++](https://google.github.io/styleguide/cppguide.html) style guides.
For the linter to work, you will need to install `black`, `flake`, `isort` and `clang-format`, and
they need to be fairly up to date.
## License
By contributing to PyTorchVideo, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bugs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: "🐛 Bugs / Unexpected behaviors"
about: Please report unexpected behaviors or bugs in PyTorchVideo.

---

If you do not know the root cause of the problem / bug, and wish someone to help you, please
post according to this template:

## 🐛 Bugs / Unexpected behaviors
<!-- A clear and concise description of the issue -->

NOTE: Please look at the existing list of Issues tagged with the label ['bug`](https://github.com/facebookresearch/pytorchvideo/issues?q=label%3Abug). **Only open a new issue if this bug has not already been reported. If an issue already exists, please comment there instead.**.

## Instructions To Reproduce the Issue:

Please include the following (depending on what the issue is):

1. Any changes you made (`git diff`) or code you wrote
```
<put diff or code here>
```
2. The exact command(s) you ran:
3. What you observed (including the full logs):
```
<put logs here>
```

Please also simplify the steps as much as possible so they do not require additional resources to
run, such as a private dataset, models, etc.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
Loading

0 comments on commit 4feccb6

Please sign in to comment.