8000 Improvement/jmlr by vturrisi · Pull Request #194 · vturrisi/solo-learn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improvement/jmlr #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4d7349d
wip
vturrisi Nov 19, 2021
6f9d940
wip
vturrisi Nov 19, 2021
9ebc866
fixed overview
vturrisi Nov 19, 2021
bccf62c
contributing
vturrisi Nov 23, 2021
84d4979
code of conduct
vturrisi Nov 24, 2021
7ad2c0b
templates
vturrisi Nov 24, 2021
41bbe09
Merge branch 'main' of github.com:vturrisi/solo-learn into improvemen…
vturrisi Nov 24, 2021
6d75682
small fixes
vturrisi Nov 24, 2021
626424f
small fixes
vturrisi Nov 24, 2021
80d3b79
add vibcreg gdown links
vturrisi Nov 24, 2021
838ab41
wip
vturrisi Nov 24, 2021
2897dd3
wip
vturrisi Nov 24, 2021
917aa92
wip
vturrisi Nov 24, 2021
fffb60c
added stuff to readme
vturrisi Nov 24, 2021
587a474
wip
vturrisi Nov 25, 2021
09b9b62
wip
vturrisi Nov 25, 2021
f7a4d52
fixes
vturrisi Nov 25, 2021
8cf3a4f
fixup: format solo with Black
Nov 25, 2021
b48cfac
wip
vturrisi Nov 25, 2021
2774ff5
Merge branch 'improvement/jmlr' of github.com:vturrisi/solo-learn int…
vturrisi Nov 25, 2021
5eae813
images
vturrisi Nov 25, 2021
727dc13
Merge branch 'improvement/jmlr' of github.com:vturrisi/solo-learn int…
vturrisi Nov 25, 2021
ec382ef
images
vturrisi Nov 25, 2021
a39f2f8
readme
vturrisi Nov 25, 2021
9257ff3
Update umap.rst
vturrisi Nov 25, 2021
7521757
new versions
vturrisi Nov 26, 2021
15a7e01
Update README.md
DonkeyShot21 Nov 26, 2021
ed3bfe0
minor
DonkeyShot21 Nov 26, 2021
338aa53
Update setup.py
vturrisi Nov 26, 2021
619a6eb
Update setup.py
vturrisi Nov 26, 2021
9aa8fc3
Update conf.py
vturrisi Nov 26, 2021
38219a5
fix
vturrisi Nov 26, 2021
a261bf7
fix
vturrisi Nov 26, 2021
d8d4549
fix dali
vturrisi Nov 26, 2021
f70566b
fix dali tests
vturrisi Nov 26, 2021
d40bbcb
added offline knn
DonkeyShot21 Nov 27, 2021
70131cf
docstrings and docs
vturrisi Nov 28, 2021
e2d9589
updated readme
vturrisi Nov 29, 2021
0821826
fixes and tutorials
vturrisi Nov 29, 2021
4bb3a36
Merge branch 'knn-offline' of github.com:vturrisi/solo-learn into imp…
vturrisi Nov 29, 2021
3823366
fixes
vturrisi Nov 29, 2021
c9d5c66
gitignore
vturrisi Nov 29, 2021
2be9cef
model zoo
vturrisi Nov 29, 2021
0368c70
model zoo
vturrisi Nov 29, 2021
d40f448
Update README.md
DonkeyShot21 Nov 29, 2021
2842827
tests
vturrisi Nov 29, 2021
43cb3ce
Merge branch 'improvement/jmlr' of github.com:vturrisi/solo-learn int…
vturrisi Nov 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).

31 changes: 23 additions & 8 deletions .gitignore
7438
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,27 @@ datasets/
*.tar
*.pkl

*.png
*.jpg
*.jpeg
bash_files/*.png
bash_files/*.jpg
bash_files/*.jpeg

downstream/*.png
downstream/*.jpg
downstream/*.jpeg

solo/*.png
solo/*.jpg
solo/*.jpeg

tests/*.png
tests/*.jpg
tests/*.jpeg

zoo/*.png
zoo/*.jpg
zoo/*.jpeg

saved_models/
model_storage/
model_storage*/
lightning_logs/

Expand Down Expand Up @@ -141,10 +156,10 @@ dmypy.json

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# !.vscode/settings.json
# !.vscode/tasks.json
# !.vscode/launch.json
# !.vscode/extensions.json

### VisualStudioCode Patch ###
# Ignore all local history of files
Expand Down
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ While the library is self-contained, it is possible to use the models outside of
---

## News
* **[Nov 29 2021]**: :bangbang: Breaking changes! Update your versions!!!
* **[Nov 29 2021]**: :book: New tutorials!
* **[Nov 29 2021]**: :rotating_light: Updated PyTorch and PyTorch Lightning versions. 10% faster.
* **[Nov 29 2021]**: :beers: Added code of conduct, contribution instructions, issue templates and UMAP tutorial.
* **[Nov 23 2021]**: :space_invader: Added [VIbCReg](https://arxiv.org/abs/2109.00783).
* **[Oct 21 2021]**: :triumph: Added support for object recognition via Detectron v2 and auto resume functionally that automatically tries to resume an experiment that crashed/reached a timeout.
* **[Oct 10 2021]**: :japanese_ogre: Restructured augmentation pipelines to allow more flexibility and multicrop. Also added multicrop for BYOL.
Expand Down Expand Up @@ -72,22 +76,30 @@ While the library is self-contained, it is possible to use the models outside of
## Requirements

* torch
* torchvision
* tqdm
* einops
* wandb
* pytorch-lightning
* lightning-bolts
* torchmetrics
* scipy
* timm

**Optional**:
* nvidia-dali

**NOTE:** if you are using CUDA 10.X change `nvidia-dali-cuda110` to `nvidia-dali-cuda100` in `setup.py`, line 7.
* matplotlib
* seaborn
* pandas
* umap-learn

---

## Installation

To install the repository with Dali and/or UMAP support, use:
First clone the repo.

Then, to install solo-learn with Dali and/or UMAP support, use:
```
pip3 install .[dali,umap]
```
Expand All @@ -97,9 +109,11 @@ If no Dali/UMAP support is needed, the repository can be installed as:
pip3 install .
```

**NOTE:** If you want to modify the library, install it in dev mode with `-e`.
**NOTE:** if you are having trouble with dali, install it with `pip install --extra-index-url https://developer.download.nvidia.com/compute/redist --upgrade nvidia-dali-cuda110` or with your specific cuda version.

**NOTE 2:** If you want to modify the library, install it in dev mode with `-e`.

**NOTE 2:** Soon to be on pip.
**NOTE 3:** Soon to be on pip.

---

Expand All @@ -113,6 +127,25 @@ After that, for offline linear evaluation, follow the examples on `bash_files/li

---

## Tutorials
Please, check out our [documentation](https://solo-learn.readthedocs.io/en/latest) and tutorials:
* [Overview](https://solo-learn.readthedocs.io/en/latest/tutorials/overview.html)
* [Offline linear eval](https://solo-learn.readthedocs.io/en/latest/tutorials/offline_linear_eval.html)
* [Object detection](https://github.com/vturrisi/solo-learn/blob/main/downstream/object_detection/README.md)
* [Adding a new method](https://github.com/vturrisi/solo-learn/blob/main/docs/source/tutorials/add_new_method.rst)
* [Adding a new momentum method](https://github.com/vturrisi/solo-learn/blob/main/docs/source/tutorials/add_new_method_momentum.rst)
* [Visualizing features with UMAP](https://github.com/vturrisi/solo-learn/blob/main/docs/source/tutorials/umap.rst)
* [Offline k-NN](https://github.com/vturrisi/solo-learn/blob/main/docs/source/tutorials/knn.rst)

---

## Model Zoo

All pretrained models avaiable can be downloaded directly via the tables below or programmatically by running one of the following scripts
`zoo/cifar10.sh`, `zoo/cifar100.sh`, `zoo/imagenet100.sh` and `zoo/imagenet.sh`.

---

## Results

**Note:** hyperparameters may not be the best, we will be re-running the methods with lower performance eventually.
Expand Down
12 changes: 12 additions & 0 deletions bash_files/knn/imagenet-100/knn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python3 ../../../main_knn.py \
--dataset imagenet100 \
--data_dir /datasets \
--train_dir imagenet-100/train \
--val_dir imagenet-100/val \
--batch_size 16 \
--num_workers 10 \
--pretrained_checkpoint_dir PATH \
--k 1 2 5 10 20 50 100 200 \
--temperature 0.01 0.02 0.05 0.07 0.1 0.2 0.5 1 \
--feature_type backbone projector \
--distance_function euclidean cosine
2 changes: 1 addition & 1 deletion bash_files/linear/imagenet-100/general_linear.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python3 ../../../main_linear.py \
--val_dir imagenet-100/val \
--max_epochs 100 \
--gpus 0,1 \
--distributed_backend ddp \
--strategy ddp \
--sync_batchnorm \
--precision 16 \
--optimizer sgd \
Expand Down
3 changes: 2 additions & 1 deletion bash_files/linear/imagenet/byol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ python3 ../../../main_linear.py \
--val_dir ILSVRC2012/val \
--max_epochs 100 \
--gpus 0 \
--accelerator ddp \
--accelerator gpu \
--strategy ddp \
--sync_batchnorm \
--precision 16 \
--optimizer sgd \
Expand Down
Loading
0