Skip to content

Commit

Permalink
Update functorch README to reflect move into PyTorch (pytorch#85832)
Browse files Browse the repository at this point in the history
Pull Request resolved: pytorch#85832
Approved by: https://github.com/Chillee
  • Loading branch information
zou3519 authored and pytorchmergebot committed Sep 28, 2022
1 parent 4985914 commit a67621a
Showing 1 changed file with 14 additions and 48 deletions.
62 changes: 14 additions & 48 deletions functorch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ transforms comes from the [JAX framework](https://github.com/google/jax).

There are two ways to install functorch:
1. functorch from source
2. functorch beta (compatible with PyTorch 1.11)
2. functorch beta (compatible with recent PyTorch releases)

We recommend trying out the functorch beta first.

Expand All @@ -54,37 +54,11 @@ Follow the instructions [in this Colab notebook](https://colab.research.google.c

#### Locally

First, set up an environment. We will be installing a nightly PyTorch binary
as well as functorch. If you're using conda, create a conda environment:
```bash
conda create --name functorch
conda activate functorch
```
If you wish to use `venv` instead:
```bash
python -m venv functorch-env
source functorch-env/bin/activate
```

Next, install one of the following following PyTorch nightly binaries.
```bash
# For CUDA 10.2
pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html --upgrade
# For CUDA 11.3
pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html --upgrade
# For CPU-only build
pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --upgrade
```
If you already have a nightly of PyTorch installed and wanted to upgrade it
(recommended!), append `--upgrade` to one of those commands.

Install functorch:
```bash
pip install ninja # Makes the build go faster
pip install --user "git+https://github.com/pytorch/functorch.git"
```
As of 9/21/2022, `functorch` comes installed alongside a nightly PyTorch binary.
Please install a Preview (nightly) PyTorch binary; see https://pytorch.org/
for instructions.

Run a quick sanity check in python:
Once you've done that, run a quick sanity check in Python:
```py
import torch
from functorch import vmap
Expand All @@ -95,28 +69,20 @@ assert torch.allclose(y, x.sin())

#### functorch development setup

`functorch` is a PyTorch C++ Extension module. To install,
As of 9/21/2022, `functorch` comes installed alongside PyTorch and is in the
PyTorch source tree. Please install
[PyTorch from source](https://github.com/pytorch/pytorch#from-source), then,
you will be able to `import functorch`.

- Install [PyTorch from source](https://github.com/pytorch/pytorch#from-source).
`functorch` usually runs on the latest development version of PyTorch.
- Run `python setup.py install`. You can use `DEBUG=1` to compile in debug mode.

Then, try to run some tests to make sure all is OK:
Try to run some tests to make sure all is OK:
```bash
pytest test/test_vmap.py -v
pytest test/test_eager_transforms.py -v
```

To do devel install:

```bash
pip install -e .
```

To install with optional dependencies, e.g. for AOTAutograd:

AOTAutograd has some additional optional requirements. You can install them via:
```bash
pip install -e .[aot]
pip install networkx
```

To run functorch tests, please install our test dependencies (`expecttest`, `pyyaml`).
Expand All @@ -125,7 +91,7 @@ To run functorch tests, please install our test dependencies (`expecttest`, `pyy
</p>
</details>

### Installing functorch beta (compatible with PyTorch 1.11)
### Installing functorch beta (compatible with recent PyTorch releases)

<details><summary>Click to expand</summary>
<p>
Expand All @@ -136,7 +102,7 @@ Follow the instructions [here](https://colab.research.google.com/drive/1GNfb01W_

#### pip

Prerequisite: [Install PyTorch 1.11](https://pytorch.org/get-started/locally/)
Prerequisite: [Install PyTorch](https://pytorch.org/get-started/locally/)


```bash
Expand Down

0 comments on commit a67621a

Please sign in to comment.