# Installing Pytorch and Transformers on IBM Power 9 architecture

The first step is to setup conda by following [conda docs](https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html).

* Specifically, I downloaded Anaconda installer from [here](https://www.anaconda.com/products/individual) (scroll at the bottom of the page). I am using the the 64-Bit (Power8 and Power9) Installer (276 MB), and at the time of writing has the following download [link](https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-ppc64le.sh).&#x20;
* You might need to restart your terminal after the above step.

```
source activate
```

After setting up conda, follow the [documentation](https://www.ibm.com/support/knowledgecenter/SS5SF7_1.7.0/navigation/wmlce_install.htm) related to IBM cloud AI to install python modules. But make sure you are using the latest channel. Alternatively, copy the below commands.

#### Add a new config channel.

```
conda config --prepend channels \
https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda-early-access/linux-ppc64le/
```

Note that I am using the early release version rather than 1.7 stable version. I am doing so because of the sentencepiece module needed for the transformers (huggingface).

#### Create a new conda environment and activate it

```
conda create --name early_access python=3.6
conda activate early_access
```

#### Install pytorch and ipython.

```
conda install pytorch
conda install ipython
```

List of all packages available for this channel are [here](https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda-early-access/linux-ppc64le/).

**Installing Huggingface** [**transformers**](https://github.com/huggingface/transformers)**.**

* Install [rust compiler](https://github.com/huggingface/transformers/issues/2831#issuecomment-600141935)
  * curl --proto '=https' --tlsv1.2 -sSf <https://sh.rustup.rs> | sh&#x20;
* Restart terminal
  * source activate
* Download Huggingface source and follow the below instructions.&#x20;

```
git clone https://github.com/huggingface/transformers
cd transformers
pip install .
```

#### Check if everything is working.

```
ipython
>> import torch
>> import transformers 
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gauravm.gitbook.io/about/blogs/installing-pytorch-and-transformers-on-ibm-powerpc-architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
