Skip to content

Commit

Permalink
fist commit
Browse files Browse the repository at this point in the history
  • Loading branch information
doxawang committed Dec 31, 2021
0 parents commit f70ea8b
Show file tree
Hide file tree
Showing 257 changed files with 21,433 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
comment:
layout: "flags, files"
behavior: default
require_changes: false
require_base: no
require_head: no
show_carryforward_flags: true

flag_management:
default_rules:
carryforward: true

coverage:
range: 40...100 # custom range of coverage colors from red -> yellow -> green
131 changes: 131 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

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

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders 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, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at `vt.turrisi@gmail.com`.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
35 changes: 35 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contributing to solo-learn
We want to make contributing to this project as easy and transparent as possible. Also, we encourage the community to help and improve the library.

## Our Development Process
We fix issues as we discover them, either by running the code or by checking the issues tab on github. Major changes (e.g., new methods, other downstream tasks, additional features etc), are added periodically and based on how we judge its priority.

## Issues
We use GitHub issues to track public bugs and questions. We will make templates for each type of issue in [issue templates](https://github.com/vturrisi/solo-learn/issues/new/choose), but for now, check if your issue has a fitting template or please be as verbose and clear as possible. Also, provide ways to reproduce the issue (e.g., bash script).


## Pull Requests
We actively welcome pull requests.

Before you start implementing a new method, make sure that the method has an accompaning paper (arxiv versions are fine) with competitive experimental results.

When implementing the new method:
1. Fork the repo and create your branch from `main`.
2. Extend the available `BaseMethod` and `BaseMomentumMethod` classes, or even the methods that are already implemented. Your new method should reuse our base structures or provide enough justification for changing/incrementing the base structures if needed.
3. Provide a clear and simple implementation following our code style.
4. Provide unit tests.
5. Modify the documentation to add the new method and accompanying features. We use Sphinx for that.
6. Provide bash files for running the method.
7. Reproduce competitive results on at least CIFAR-10 and CIFAR-100. Imagenet-100/Imagenet results are also desirable, but we can run those eventually.
8. Ensure that your tests by running `python -m pytest --cov=solo tests`.

If you are fixing a bug, please open an issue beforehand. If should also modify the library as minimally as possible.

When implementing extensions for the library, detail why this is important by providing use cases.

## Coding Style

Please follow our coding style and use [black](https://github.com/psf/black) with line length of 100. We will update this section with a more hands-on guide.

## License
By contributing to solo-learn, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bugs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!-- Adapted from https://github.com/facebookresearch/vissl/blob/main/.github/ISSUE_TEMPLATE/bugs.md -->

---
name: "🐛 Bugs"
about: Report bugs in solo-learn
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 information about your environment.

## When to expect Triage

We try to answer as soon as possible, but time may vary according to other deadlines and the importance of the bug reported.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/new_method.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- Adapted from https://github.com/facebookresearch/vissl/blob/main/.github/ISSUE_TEMPLATE/new-ssl-approach.md -->

---
name: "\U0001F31F New SSL method addition"
about: Submit a proposal of implementation/request to implement a new SSL method in solo-learn.

---

# 🌟 New SSL method addition

## Approach description

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

## Status of the current implement

Information regarding stuff that you have already implemented for the method.
As a general checklist, you should have:
* [ ] the method implemented as new file in `solo/methods` and added to `solo/methods/__init__.py`
* [ ] the loss implemented as new file in `solo/losses` and added to `solo/losses/__init__.py`
* [ ] bash files to run experiments
* [ ] tests for the method and the loss(es) in `tests/methods` and `tests/losses`.
* [ ] add documentation to `docs/source/solo/methods` and `docs/source/solo/losses`, and modify `docs/source/index.rst` to reference the new files (use alphabetical order).
* [ ] check if all tests pass by running `python -m pytest --cov=solo tests`.
* [ ] reproduce competitive results on at least CIFAR10/CIFAR100 (possibly Imagenet-100 and Imagenet).

42 changes: 42 additions & 0 deletions .github/workflows/autoblack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: autoblack
on:
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Black
run: pip install black

- name: Run black check on solo
run: black --check --line-length 100 solo

- name: If needed, commit black changes to the pull request
if: failure()
run: |
black --line-length 100 solo
git config --global user.name 'autoblack'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "fixup: format solo with Black"
git push
- name: Run black --check on tests
run: black --check --line-length 100 tests

- name: If needed, commit black changes to the pull request
if: failure()
run: |
black --line-length 100 tests
git config --global user.name 'autoblack'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "fixup: format tests with Black"
git push
64 changes: 64 additions & 0 deletions .github/workflows/dali_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: dali-tests

# never run automatically since it needs gpus
on:
push:
branches-ignore:
- '**'

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python }}-pip-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[umap] codecov mypy pytest-cov black
- name: Cache datasets
uses: actions/cache@v2
with:
path: ~/datasets
key: ${{ runner.os }}

- name: pytest
run: pytest --cov=solo tests/dali

- name: Statistics
if: success()
run: |
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: always()
# see: https://github.com/actions/toolkit/issues/399
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: dali
name: DALI-coverage
fail_ci_if_error: false
Loading

0 comments on commit f70ea8b

Please sign in to comment.