Skip to content

Commit

Permalink
Merge pull request #14 from cleanlab/revamp
Browse files Browse the repository at this point in the history
Updated with cleanvision==0.3.0
  • Loading branch information
sanjanag authored May 27, 2023
2 parents f2100ea + f73d487 commit c83a21c
Show file tree
Hide file tree
Showing 10 changed files with 2,500 additions and 6,338 deletions.
76 changes: 76 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Development

This guide provides a checklist for contributing new cleanvision examples.

- Ensure that the notebook contains cell outputs and that they look as expected in Jupyter notebook and **on GitHub**.
Note this is different than our tutorials in the main cleanvision repository (where notebook cells should not be
executed)! Unlike the tutorials, we want examples notebooks to also look good in GitHub's viewer (which has limited
rendering functionality, so avoid things like `<div>` that GitHub's viewer does not render properly).

- Ensure that the jupyter notebook cells are executed in order. Additionally clear any cell blocks that are too large (
eg. model training code that specifies accuracy for each epoch), it is ok if these do not have an execution number
after being cleared.

- The first cell of the notebook should be a markdown block containing the text:
```
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/cleanlab/cleanvision-examples/blob/main/{ relative path to notebook }.ipynb)
```
Replace the `{ relative path to notebook }` portion with the path to the notebook relative to the root folder.
> eg. the [caltech256.ipynb](caltech256.ipynb) notebook will have a relative path of `caltech256.ipynb` and will have
the badge:
>
> ```
> [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/cleanlab/cleanvision-examples/blob/main/caltech256.ipynb)
> ```
This will create a badge that will link to a Google Colab version of the notebook.
Note that the Colab badge links to the notebook in the main branch, so at the time of making the PR, the link will be
invalid. Please remember to check that the Colab link works after the PR has been approved and merged to `main`.
The Colab badge must also be in its own notebook cell, not with other content.
- Ensure that your notebook is using the correct kernel. In jupyter notebook, you can check the notebook's metadata by
navigating to `Edit` > `Edit Notebook Metadata` and check if the follow fields match this:
```json
"kernelspec": {
"name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python"
}
```

- Add the notebook to the [README](README.md), ideally grouping the newly added example with any other related examples.

- After a new notebook has been added and pushed to `main` branch, AVOID changing the notebook and folder names, as this
may break existing links referencing the example notebook throughout cleanvision documentation, blog posts, and more.

- If the example requires some packages other than the ones in [requirements-dev.txt](requirements-dev.txt), Please
create a separate `requirements.txt` specific to that example with extra packages required. Put these requirements and
any related jupyter notebooks in a directory instead of the root folder.

## Set up the environment for running notebooks

While this is not required, we recommend that you do development and testing in a virtual environment. There are a
number of tools to do this, including [virtualenv](https://virtualenv.pypa.io/), [pipenv](https://pipenv.pypa.io/),
and [venv](https://docs.python.org/3/library/venv.html). You
can [compare](https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe)
the tools and choose what is right for you. Here, we'll explain how to get set up with venv, which is built in to Python

```shell
python3 -m venv cleanvision-examples
source cleanvision-examples/bin/activate
pip install --upgrade pip
pip install -r requirements-dev.txt
python -m ipykernel install --user --name=cleanvision-examples
```

Choose the `cleanvision-examples` kernel in the jupyter notebook when running.

You only need to create the virtual environment once, but you will need to
activate it every time you start a new shell. Once the virtual environment is
activated, the `pip install` commands below will install dependencies into the
virtual environment rather than your system Python installation.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# cleanvision-examples

Notebooks demonstrating example applications of the [cleanvision](https://github.com/cleanlab/cleanvision/) library.
The notebooks in this repository demonstrate the example applications
of [CleanVision](https://github.com/cleanlab/cleanvision/) on following datasets.

- [Caltech-256](caltech256.ipynb)
- [Caltech-UCSD Birds-200-2011 (CUB-200-2011)](cub200.ipynb)
- [CIFAR10](cifar10.ipynb)
- [Food-101](food101.ipynb)

For a quick-start tutorial on different ways to use this package,
check [Tutorials](https://cleanvision.readthedocs.io/en/latest/tutorials/tutorial.html#)

## Installation

You can install the most recent stable version of the package via

```shell
pip install cleanvision
```

More information on installation can be found [here](https://cleanvision.readthedocs.io/en/latest/#installation).

Some recently-added examples may require the developer version of the package, which you can install via:

```shell
pip install git+https://github.com/cleanlab/cleanvision.git
```

For a comprehensive quick-start tutorial on different ways to use this package, start with: [tutorial.ipynb](tutorial.ipynb).

Unless stated otherwise, notebooks here correspond to the [latest bleeding-edge version](https://github.com/cleanlab/cleanvision/tree/main/) of the CleanVision package. These notebooks install this [latest version](https://github.com/cleanlab/cleanvision/tree/main/) of CleanVision (which is undergoing rapid development).

You can instead install the most recent stable version of the package via: `pip install cleanvision`
352 changes: 214 additions & 138 deletions caltech256.ipynb

Large diffs are not rendered by default.

608 changes: 299 additions & 309 deletions cifar10.ipynb

Large diffs are not rendered by default.

272 changes: 170 additions & 102 deletions cub200.ipynb

Large diffs are not rendered by default.

3,338 changes: 1,707 additions & 1,631 deletions food101.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit c83a21c

Please sign in to comment.