Update functorch README to reflect move into PyTorch (#85832)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/85832
Approved by: https://github.com/Chillee
This commit is contained in:
Richard Zou 2022-09-28 11:31:47 -07:00 committed by PyTorch MergeBot
parent 498591467b
commit a67621a6ca

View File

@ -39,7 +39,7 @@ transforms comes from the [JAX framework](https://github.com/google/jax).
There are two ways to install functorch: There are two ways to install functorch:
1. functorch from source 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. We recommend trying out the functorch beta first.
@ -54,37 +54,11 @@ Follow the instructions [in this Colab notebook](https://colab.research.google.c
#### Locally #### Locally
First, set up an environment. We will be installing a nightly PyTorch binary As of 9/21/2022, `functorch` comes installed alongside a nightly PyTorch binary.
as well as functorch. If you're using conda, create a conda environment: Please install a Preview (nightly) PyTorch binary; see https://pytorch.org/
```bash for instructions.
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. Once you've done that, run a quick sanity check in Python:
```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"
```
Run a quick sanity check in python:
```py ```py
import torch import torch
from functorch import vmap from functorch import vmap
@ -95,28 +69,20 @@ assert torch.allclose(y, x.sin())
#### functorch development setup #### 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). Try to run some tests to make sure all is OK:
`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:
```bash ```bash
pytest test/test_vmap.py -v pytest test/test_vmap.py -v
pytest test/test_eager_transforms.py -v pytest test/test_eager_transforms.py -v
``` ```
To do devel install: AOTAutograd has some additional optional requirements. You can install them via:
```bash ```bash
pip install -e . pip install networkx
```
To install with optional dependencies, e.g. for AOTAutograd:
```bash
pip install -e .[aot]
``` ```
To run functorch tests, please install our test dependencies (`expecttest`, `pyyaml`). To run functorch tests, please install our test dependencies (`expecttest`, `pyyaml`).
@ -125,7 +91,7 @@ To run functorch tests, please install our test dependencies (`expecttest`, `pyy
</p> </p>
</details> </details>
### Installing functorch beta (compatible with PyTorch 1.11) ### Installing functorch beta (compatible with recent PyTorch releases)
<details><summary>Click to expand</summary> <details><summary>Click to expand</summary>
<p> <p>
@ -136,7 +102,7 @@ Follow the instructions [here](https://colab.research.google.com/drive/1GNfb01W_
#### pip #### pip
Prerequisite: [Install PyTorch 1.11](https://pytorch.org/get-started/locally/) Prerequisite: [Install PyTorch](https://pytorch.org/get-started/locally/)
```bash ```bash