Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
fbshipit-source-id: 8c68a6e8b640539a953e62f7dc5679e41656fd00
  • Loading branch information
facebook-github-bot committed Jan 26, 2021
0 parents commit a5c973b
Show file tree
Hide file tree
Showing 740 changed files with 69,041 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .circleci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CircleCI for VISSL

We test every PR, commit on CircleCI (cpu and gpu tests) in CUDA 10.2, pip, python3 environment. See https://app.circleci.com/pipelines/github/facebookresearch/vissl .
220 changes: 220 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2

# -------------------------------------------------------------------------------------
# Environments to run the jobs in
# -------------------------------------------------------------------------------------
cpu: &cpu
environment:
TERM: xterm
machine:
image: default
resource_class: medium

gpu: &gpu
environment:
CUDA_VER: "10.2"
TORCH_CUDA_ARCH_LIST: "5.0;5.2;5.3"
TERM: xterm
machine:
image: ubuntu-1604:201903-01
resource_class: gpu.medium # Tesla M60

# -------------------------------------------------------------------------------------
# Re-usable commands
# -------------------------------------------------------------------------------------
install_python: &install_python
- run:
name: Install Python
working_directory: ~/
command: |
pyenv versions
pyenv install 3.6.2
pyenv global 3.6.2
update_gcc7: &update_gcc7
- run:
name: Update GCC7
working_directory: ~/
command: |
sudo apt-get update
sudo add-apt-repository ppa:jonathonf/gcc
sudo apt-get update
sudo apt-get install gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7 --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-7 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7
gcc --version
g++ --version
install_classy_vision: &install_classy_vision
- run:
name: Install ClassyVision
working_directory: ~/
command: |
pip uninstall -y classy_vision
pip install classy-vision@https://github.com/facebookresearch/ClassyVision/tarball/master
setupcuda: &setupcuda
run:
name: Setup CUDA and NVIDIA driver
working_directory: ~/
command: |
# download and install nvidia drivers, cuda, etc
wget --no-verbose --no-clobber -P ~/nvidia-downloads 'https://s3.amazonaws.com/ossci-linux/nvidia_driver/NVIDIA-Linux-x86_64-430.40.run'
wget --no-verbose --no-clobber -P ~/nvidia-downloads http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo /bin/bash ~/nvidia-downloads/NVIDIA-Linux-x86_64-430.40.run --no-drm -q --ui=none
sudo sh ~/nvidia-downloads/cuda_10.2.89_440.33.01_linux.run --silent
echo "Done installing CUDA."
nvidia-smi
setup_venv: &setup_venv
- run:
name: Setup Virtual Environment
command: |
python -m venv ~/vissl_venv
echo ". ~/vissl_venv/bin/activate" >> $BASH_ENV
. ~/vissl_venv/bin/activate
python --version
which python
which pip
pip install --upgrade pip
pip install -U setuptools
pip_list: &pip_list
- run:
name: Pip list
command: |
pip list
install_vissl_dep: &install_vissl_dep
- run:
name: Install Dependencies
working_directory: ~/vissl
command: |
pip install --progress-bar off torch==1.5.0 torchvision==0.6.0 opencv-python==3.4.2.17
pip install --progress-bar off -r requirements.txt
install_apex_gpu: &install_apex_gpu
- run:
name: Install Apex
working_directory: ~/vissl
environment:
CUDA_VER: "10.2"
TORCH_CUDA_ARCH_LIST: "5.0;5.2;5.3"
command: |
bash ./docker/common/install_apex.sh
install_apex_cpu: &install_apex_cpu
- run:
name: Install Apex for CPU
working_directory: ~/vissl
command: |
pip install -v --no-cache-dir apex@https://github.com/NVIDIA/apex/tarball/1f2aa9156547377a023932a1512752c392d9bbdf
install_vissl: &install_vissl
- run:
name: Install VISSL
command: |
pip install -U --progress-bar off -e .[dev]
run_unittests: &run_unittests
- run:
name: Run CPU Unit Tests
command: |
python -m unittest discover -v -s tests
# -------------------------------------------------------------------------------------
# Jobs to run (cpu and gpu)
# -------------------------------------------------------------------------------------
jobs:
cpu_tests:
<<: *cpu

working_directory: ~/vissl

steps:
- checkout
- <<: *install_python
- <<: *setup_venv

# Cache the vissl_venv directory that contains dependencies
- restore_cache:
keys:
- v2-cpu-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "setup.py" }}

- <<: *install_vissl_dep
- <<: *install_classy_vision
- <<: *install_apex_cpu
- <<: *pip_list

- save_cache:
paths:
- ~/vissl_venv
key: v2-cpu-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "setup.py" }}

- <<: *install_vissl

- run:
name: isort
command: |
isort -y -sp .
- run:
name: black
command: |
black .
- run:
name: flake8
command: |
flake8 --max-line-length 88 --ignore E501,E203,E266,W503,E741 .
- <<: *run_unittests

gpu_tests:
<<: *gpu

working_directory: ~/vissl

steps:
- checkout
- <<: *setupcuda
- <<: *install_python
- <<: *setup_venv

# Download and cache dependencies
- restore_cache:
keys:
- v2-gpu-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "setup.py" }}-{{ checksum "docker/common/install_apex.sh" }}

- <<: *install_vissl_dep
- <<: *install_classy_vision
- <<: *update_gcc7
- <<: *install_apex_gpu
- <<: *pip_list

- run:
name: Check CUDA Available
command: python -c "import torch; assert torch.cuda.is_available(), 'CUDA not available'"

- save_cache:
paths:
- ~/vissl_venv
key: v2-gpu-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "setup.py" }}-{{ checksum "docker/common/install_apex.sh" }}

- <<: *install_vissl

- run:
name: Run GPU tests
command: bash ./dev/run_quick_tests.sh

# -------------------------------------------------------------------------------------
# Workflows
# -------------------------------------------------------------------------------------
workflows:
version: 2
build_and_test:
jobs:
- cpu_tests
- gpu_tests
5 changes: 5 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to.
Please read the [full text](https://code.fb.com/codeofconduct/)
so that you can understand what actions will and will not be tolerated.
54 changes: 54 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Contributing to VISSL
We want to make contributing to this project as easy and transparent as possible.

## Our Development Process
Minor changes and improvements will be released on an ongoing basis. Larger changes (e.g., changesets implementing a new SSL approach, benchmark, new scaling feature etc) will be released on a more periodic basis.

## Issues
We use GitHub issues to track public bugs and questions. Please make sure to follow one of the
[issue templates](https://github.com/facebookresearch/vissl/issues/new/choose)
when reporting any issues.

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.

## Pull Requests
We actively welcome your pull requests.

However, if you're adding any significant features (e.g. > 50 lines), please
make sure to have a corresponding issue to discuss your motivation and proposals,
before sending a PR. We do not always accept new features, and we take the following
factors into consideration:

1. Whether the same feature can be achieved without modifying vissl.
VISSL is designed to be extensible so that it's easy to extend any modular component and train custom models. If some part is not as extensible, you can also bring up the issue to make it more extensible.
2. Whether the feature is potentially useful to a large audience, or only to a small portion of users.
3. Whether the proposed solution has a good design / interface.
4. Whether the proposed solution adds extra mental/practical overhead to users who don't
need such feature.
5. Whether the proposed solution breaks existing APIs.

When sending a PR, please do:

1. Fork the repo and create your branch from `master`.
2. If a PR contains multiple orthogonal changes, split it to several PRs.
3. If you've added code that should be tested, add tests.
4. If you've changed APIs, update the documentation.
5. Ensure the test suite passes. Follow [cpu test instructions](https://github.com/facebookresearch/vissl/blob/master/tests/README.md) and [integration tests][https://github.com/facebookresearch/vissl/blob/master/dev/run_quick_tests.sh].
6. Make sure your code follows our coding practices (see next section).
7. If you haven't already, complete the Contributor License Agreement ("CLA").

## Coding Style

Please follow [our coding practices](https://github.com/facebookresearch/vissl/blob/master/dev/README.md#practices-for-coding-quality) and choose either option to properly format your code before submitting PRs.

## 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>

## License
By contributing to ssl_framework, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bugs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: "🐛 Bugs"
about: Report bugs in vissl
title: Please read & provide the following

---

## Instructions To Reproduce the 🐛 Bug:

1. what changes you made (`git diff`) or what code you wrote
```
<put diff or code here>
```
2. what exact command you run:
3. what you observed (including __full logs__):
```
<put logs here>
```
4. please simplify the steps as much as possible so they do not require additional resources to
run, such as a private dataset.

## Expected behavior:

If there are no obvious error in "what you observed" provided above,
please tell us the expected behavior.

## Environment:

Provide your environment information using the following command:
```
wget -nc -q https://github.com/facebookresearch/vissl/raw/master/vissl/utils/collect_env.py && python collect_env.py
```

## When to expect Triage

VISSL devs and contributors aim to triage issues asap however, as a general guideline, we ask users to expect triaging in 1-2 weeks.
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: "\U0001F4DA VISSL Documentation"
about: Report an issue related to VISSL documentation

---

## 📚 VISSL Documentation

A clear and concise description of what content in the [Docs](https://github.com/facebookresearch/vissl/tree/master/docs) is an issue.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: "\U0001F680 Feature request"
about: Suggest an improvement or new feature

---

## 🚀 Feature
A clear and concise description of the feature proposal.

## Motivation & Examples

Tell us why the feature is useful.

Describe what the feature would look like, if it is implemented.
Best demonstrated using **code examples** in addition to words.

## Note

1. We only consider adding new features if they are relevant to many users.

2. If your request is about a new ssl approach addition or new benchmarks, please choose [New Benchmark](https://github.com/facebookresearch/vissl/issues/new/choose) issue template or [New SSL Approach](https://github.com/facebookresearch/vissl/issues/new/choose) issue template.

3. "Make A faster" is not a valid feature request. "Implement a concrete feature that can make A faster" can be a valid feature request.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/new-benchmark.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: "\U0001F31F New Benchmark addition"
about: Submit a proposal/request to implement a new SSL Benchmark in VISSL

---

# 🌟 New SSL Benchmark

## Approach description

Important information only describing the benchmark, link to the arXiv paper describing the benchmark method.

## Open source status

* [ ] the benchmark implementation is available: (give details)
* [ ] the benchmark has been tested on few ssl approaches: (give details)
* [ ] who are the authors: (mention them, if possible by @gh-username)
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/new-ssl-approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: "\U0001F31F New SSL approach addition"
about: Submit a proposal/request to implement a new SSL approach in VISSL

---

# 🌟 New SSL approach addition

## Approach description

Important information only describing the approach, link to the arXiv paper.

## Open source status

* [ ] the model implementation is available: (give details)
* [ ] the model weights are available: (give details)
* [ ] who are the authors: (mention them, if possible by @gh-username)
Loading

0 comments on commit a5c973b

Please sign in to comment.