Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Installation Section in README.md #35094

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7b8417e
Update README.md
egojoseph Dec 4, 2024
90baa07
Update README.md
egojoseph Dec 4, 2024
b962abe
Update README.md
egojoseph Dec 4, 2024
1ac5018
Update README.md
egojoseph Dec 4, 2024
5d9fd1a
Update README.md
egojoseph Dec 4, 2024
21e54df
Update README.md
egojoseph Dec 4, 2024
cf1a330
Update README.md
egojoseph Dec 4, 2024
bb5f92e
Update README.md
egojoseph Dec 4, 2024
804bc21
Update README.md
egojoseph Dec 4, 2024
40ca3cc
Update README.md
egojoseph Dec 4, 2024
4c2cd0b
Update README.md
egojoseph Dec 4, 2024
f236ceb
Update README.md
egojoseph Dec 4, 2024
309cf38
Update README.md
egojoseph Dec 4, 2024
ea598f9
Update README.md
egojoseph Dec 4, 2024
8cae929
Update README.md
egojoseph Dec 4, 2024
15a9132
Update README.md
egojoseph Dec 4, 2024
dc8b260
Update README.md
egojoseph Dec 4, 2024
6566fb3
Merge branch 'main' into Installation-Improvement-ByEgo
egojoseph Dec 24, 2024
10e6817
Merge branch 'main' into Installation-Improvement-ByEgo
egojoseph Dec 28, 2024
a8f9491
Merge branch 'main' into Installation-Improvement-ByEgo
egojoseph Jan 3, 2025
5c7516a
Update installation.md
egojoseph Jan 4, 2025
f499072
Update installation.md
egojoseph Jan 4, 2025
bb947f0
Update installation.md
egojoseph Jan 4, 2025
5f9b3ed
Update installation.md
egojoseph Jan 4, 2025
3b75bbb
Update installation.md
egojoseph Jan 4, 2025
751789e
Update installation.md
egojoseph Jan 4, 2025
3fed106
Update installation.md
egojoseph Jan 4, 2025
bdc7775
Update installation.md
egojoseph Jan 4, 2025
97d45e5
Update installation.md
egojoseph Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 60 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,26 +247,47 @@ The model itself is a regular [Pytorch `nn.Module`](https://pytorch.org/docs/sta

## Installation

### With pip
### 1. With pip

This repository is tested on Python 3.9+, Flax 0.4.1+, PyTorch 2.0+, and TensorFlow 2.6+.

You should install 🤗 Transformers in a [virtual environment](https://docs.python.org/3/library/venv.html). If you're unfamiliar with Python virtual environments, check out the [user guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).

First, create a virtual environment with the version of Python you're going to use and activate it.
**a) First, create a virtual environment with the version of Python you're going to use and activate it.**

Then, you will need to install at least one of Flax, PyTorch, or TensorFlow.
Please refer to [TensorFlow installation page](https://www.tensorflow.org/install/), [PyTorch installation page](https://pytorch.org/get-started/locally/#start-locally) and/or [Flax](https://github.com/google/flax#quick-install) and [Jax](https://github.com/google/jax#installation) installation pages regarding the specific installation command for your platform.
**For macOS/Linux:**
```python -m venv env
source env/bin/activate
```
**For Windows:**
``` python -m venv env
env\Scripts\activate
```

**b) Install a backend framework:**
To use 🤗 Transformers, you must install at least one of Flax, PyTorch, or TensorFlow. Refer to the official installation guides for platform-specific commands:

[TensorFlow installation page](https://www.tensorflow.org/install/),
[PyTorch installation page](https://pytorch.org/get-started/locally/#start-locally) and/or [Flax](https://github.com/google/flax#quick-install) and [Jax](https://github.com/google/jax#installation)

When one of those backends has been installed, 🤗 Transformers can be installed using pip as follows:

```bash
**c) Install 🤗 Transformers:**
```
pip install transformers
```

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/docs/transformers/installation#installing-from-source).

### With conda
**d) Optional: Install from source for the latest updates:**

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

### 2. With conda

🤗 Transformers can be installed using conda as follows:

Expand All @@ -280,6 +301,39 @@ Follow the installation pages of Flax, PyTorch or TensorFlow to see how to insta

> **_NOTE:_** On Windows, you may be prompted to activate Developer Mode in order to benefit from caching. If this is not an option for you, please let us know in [this issue](https://github.com/huggingface/huggingface_hub/issues/1062).

### 3. GPU Setup (Optional)

For GPU acceleration, install the appropriate CUDA drivers for your system:

a) PyTorch CUDA Compatibility: ( https://pytorch.org/get-started/locally)

b) TensorFlow GPU Support: (https://www.tensorflow.org/install/pip)

**Verify GPU availability:**
```
nvidia-smi
```
### 4. Troubleshooting
**a) Error: Python Version Not Supported:**

Ensure you’re using Python 3.9 or later:
```
python --version
```
**b) Error: Missing Dependencies:**

Install all required dependencies:
```
pip install -r requirements.txt
```
**c) Windows-Specific Issues:**

Activate Developer Mode if prompted. Alternatively, use a virtual environment:
```
Copy code
python -m venv env
env\Scripts\activate
```
## Model architectures

**[All the model checkpoints](https://huggingface.co/models)** provided by 🤗 Transformers are seamlessly integrated from the huggingface.co [model hub](https://huggingface.co/models), where they are uploaded directly by [users](https://huggingface.co/users) and [organizations](https://huggingface.co/organizations).
Expand Down
63 changes: 53 additions & 10 deletions docs/source/en/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ You should install 🤗 Transformers in a [virtual environment](https://docs.pyt

Start by creating a virtual environment in your project directory:

```bash
python -m venv .env
```
### Create and Activate a Virtual Environment

Activate the virtual environment. On Linux and MacOs:
To avoid dependency conflicts, it’s recommended to use a virtual environment.

```bash
source .env/bin/activate
#### For macOS/Linux:
```
Activate Virtual environment on Windows

```bash
.env/Scripts/activate
python3 -m venv env
source env/bin/activate
```
#### For window OS:
```
python -m venv env
.\env\Scripts\activate
```

Now you're ready to install 🤗 Transformers with the following command:
Expand Down Expand Up @@ -254,3 +254,46 @@ Once your file is downloaded and locally cached, specify it's local path to load
See the [How to download files from the Hub](https://huggingface.co/docs/hub/how-to-downstream) section for more details on downloading files stored on the Hub.

</Tip>

# Troubleshooting

## a) Error: Python Version Not Supported
Ensure you are using Python 3.9 or later.
To check your Python version, run:
```
python --version
```
## b) Error: Missing Dependencies

Install all required dependencies by running:
```
pip install -r requirements.txt
```
Ensure you’re in the project directory before executing the command.

## c) Windows-Specific Issues

If you encounter issues on Windows, you may need to activate Developer Mode.

To enable it, navigate to Windows Settings > For Developers > Developer Mode.

Alternatively, create and activate a virtual environment as shown below:

```
python -m venv env
.\env\Scripts\activate
```

### GPU Setup (Optional)

For GPU acceleration, install the appropriate CUDA drivers for your system:

a) PyTorch CUDA Compatibility: (https://pytorch.org/get-started/locally)
b) TensorFlow GPU Support: (https://www.tensorflow.org/install/pip)

#### Verify GPU availability:

To check if your system detects an NVIDIA GPU, run:
```bash
nvidia-smi
```