Unverified Commit 15e4ce35 authored by Stas Bekman's avatar Stas Bekman Committed by GitHub
Browse files

[docs] expand install instructions (#9817)



* expand install instructions

* fix

* white space

* rewrite as discussed in the PR

* Apply suggestions from code review
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>

* change the wording to encourage issue report
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent 4c3ae89a
...@@ -167,7 +167,7 @@ When TensorFlow 2.0 and/or PyTorch has been installed, 🤗 Transformers can be ...@@ -167,7 +167,7 @@ When TensorFlow 2.0 and/or PyTorch has been installed, 🤗 Transformers can be
pip install transformers pip install transformers
``` ```
If you'd like to play with the examples, you must [install the library from source](https://huggingface.co/transformers/installation.html#installing-from-source). If you'd like to play with the examples or need the bleeding edge of the code and can't wait for a new release, you must [install the library from source](https://huggingface.co/transformers/installation.html#installing-from-source).
### With conda ### With conda
......
...@@ -73,7 +73,27 @@ It should download a pretrained model then print something like ...@@ -73,7 +73,27 @@ It should download a pretrained model then print something like
## Installing from source ## Installing from source
To install from source, clone the repository and install with the following commands: Here is how to quickly install `transformers` from source:
```bash
pip install git+https://github.com/huggingface/transformers
```
Note that this will install not the latest released version, but the bleeding edge `master` version, which you may want to use in case a bug has been fixed since the last official release and a new release hasn't been yet rolled out.
While we strive to keep `master` operational at all times, if you notice some issues, they usually get fixed within a few hours or a day and and you're more than welcome to help us detect any problems by opening an [Issue](https://github.com/huggingface/transformers/issues) and this way, things will get fixed even sooner.
Again, you can run:
```bash
python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I hate you'))"
```
to check 🤗 Transformers is properly installed.
## Editable install
If you want to constantly use the bleeding edge `master` version of the source code, or if you want to contribute to the library and need to test the changes in the code you're making, you will need an editable install. This is done by cloning the repository and installing with the following commands:
``` bash ``` bash
git clone https://github.com/huggingface/transformers.git git clone https://github.com/huggingface/transformers.git
...@@ -81,13 +101,22 @@ cd transformers ...@@ -81,13 +101,22 @@ cd transformers
pip install -e . pip install -e .
``` ```
Again, you can run This command performs a magical link between the folder you cloned the repository to and your python library paths, and it'll look inside this folder in addition to the normal library-wide paths. So if normally your python packages get installed into:
```
~/anaconda3/envs/main/lib/python3.7/site-packages/
```
now this editable install will reside where you clone the folder to, e.g. `~/transformers/` and python will search it too.
Do note that you have to keep that `transformers` folder around and not delete it to continue using the `transfomers` library.
Now, let's get to the real benefit of this installation approach. Say, you saw some new feature has been just committed into `master`. If you have already performed all the steps above, to update your transformers to include all the latest commits, all you need to do is to `cd` into that cloned repository folder and update the clone to the latest version:
```bash ```
python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I hate you'))" cd ~/transformers/
git pull
``` ```
to check 🤗 Transformers is properly installed. There is nothing else to do. Your python environment will find the bleeding edge version of `transformers` on the next run.
## With conda ## With conda
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment