Skip to content

Commit 5ea3fd5

Browse files
committed
Add Anaconda installation instructions
1 parent 9af137f commit 5ea3fd5

File tree

3 files changed

+51
-17
lines changed

3 files changed

+51
-17
lines changed

README.md

+19-17
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,34 @@ To run these notebooks on a cloud platform, just click on one of the badges in t
3434

3535
Nowadays, the GPUs on Colab tend to be K80s (which have limited memory), so we recommend using [Kaggle](https://www.kaggle.com/docs/notebooks), [Gradient](https://gradient.run/notebooks), or [SageMaker Studio Lab](https://studiolab.sagemaker.aws/). These platforms tend to provide more performant GPUs like P100s, all for free!
3636

37+
> Note: some cloud platforms like Kaggle require you to restart the notebook after installing new packages.
38+
3739
### Running on your machine
3840

39-
To run the notebooks on your own machine, first clone the repository:
41+
To run the notebooks on your own machine, first clone the repository and navigate to it:
4042

41-
```
42-
git clone https://github.com/nlp-with-transformers/notebooks
43-
cd notebooks-test
43+
```bash
44+
$ git clone https://github.com/nlp-with-transformers/notebooks.git
45+
$ cd notebooks
4446
```
4547

46-
Next, you'll need to install a few packages that depend on your operating system and hardware:
48+
Next, run the following command to create a `conda` virtual environment that contains all the libraries needed to run the notebooks:
4749

48-
* [PyTorch](https://pytorch.org/get-started/locally/)
49-
* [TensorFlow](https://www.tensorflow.org/install/) (optional, since only used in a few chapters)
50-
* [PyTorch Scatter](https://github.com/rusty1s/pytorch_scatter) (only used in Chapter 11)
51-
* [librosa](https://librosa.org/) (only used in Chapter 11)
52-
* [libsndfile](http://www.mega-nerd.com/libsndfile/) (only used in Chapter 11)
50+
```bash
51+
$ conda env create -f environment.yml
52+
```
5353

54-
Once you have install the above requirements, create a virtual environment and install the remaining Python dependencies:
54+
Chapter 7 (Question Answering) has a special set of dependencies, so to run that chapter you'll need a separate environment:
5555

56+
```bash
57+
$ conda env create -f environment-chapter7.yml
5658
```
57-
conda create -n book python=3.8 -y && conda activate book
58-
python
59-
>>from install import *
60-
>>install_requirements()
61-
# Use the following to run Chapter 7
62-
# install_requirements(is_chapter7)
59+
60+
Once you've installed the dependencies, you can activate the `conda` environment and spin up the notebooks as follows:
61+
62+
```bash
63+
$ conda activate book # or conda activate book-chapter7
64+
$ jupyter notebook
6365
```
6466

6567
## Citations

environment-chapter7.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: book-chapter7
2+
channels:
3+
- pytorch
4+
- defaults
5+
dependencies:
6+
- python=3.9
7+
- cudatoolkit=11.0
8+
- pip
9+
- notebook
10+
- ipykernel
11+
- pip:
12+
- farm-haystack==0.9.0
13+
- datasets==1.11.0
14+
- matplotlib
15+
- ipywidgets

environment.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: book
2+
channels:
3+
- pytorch
4+
- defaults
5+
- pyg
6+
dependencies:
7+
- python=3.9
8+
- cudatoolkit=11.0
9+
- pytorch-scatter
10+
- pip
11+
- notebook
12+
- ipykernel
13+
- ipywidgets
14+
- git-lfs
15+
- libsndfile
16+
- pip:
17+
- -r requirements.txt

0 commit comments

Comments
 (0)