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

Merged
merged 45 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
45 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
6692766
Merge branch 'main' into Installation-Improvement-ByEgo
egojoseph Jan 9, 2025
dd000ee
Merge branch 'main' into Installation-Improvement-ByEgo
egojoseph Jan 11, 2025
7261bae
Update README.md
egojoseph Jan 11, 2025
8bfe87b
Update README.md
egojoseph Jan 11, 2025
bd022e3
Update README.md
egojoseph Jan 11, 2025
cf10435
Update README.md
egojoseph Jan 11, 2025
a05ea33
Update README.md
egojoseph Jan 11, 2025
cc03441
Update README.md
egojoseph Jan 11, 2025
69f9480
Update README.md
egojoseph Jan 11, 2025
7d1f292
Update README.md
egojoseph Jan 11, 2025
b77d668
Update installation.md
egojoseph Jan 11, 2025
c442f7d
Update installation.md
egojoseph Jan 11, 2025
96b44cd
Update installation.md
egojoseph Jan 11, 2025
42abffe
Update installation.md
egojoseph Jan 11, 2025
8c1d10b
Merge branch 'main' into Installation-Improvement-ByEgo
egojoseph Jan 13, 2025
7b588d7
Update README.md
egojoseph Jan 13, 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
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,37 @@ You should install 🤗 Transformers in a [virtual environment](https://docs.pyt

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.
**macOS/Linux**

```python -m venv env
source env/bin/activate
```

**Windows**

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

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
```
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).

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

### With conda

🤗 Transformers can be installed using conda as follows:
Expand All @@ -280,6 +300,27 @@ 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).

### Troubleshooting
egojoseph marked this conversation as resolved.
Show resolved Hide resolved
**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
52 changes: 38 additions & 14 deletions docs/source/en/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,18 @@ Install 🤗 Transformers for whichever deep learning library you're working wit

You should install 🤗 Transformers in a [virtual environment](https://docs.python.org/3/library/venv.html). If you're unfamiliar with Python virtual environments, take a look at this [guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/). A virtual environment makes it easier to manage different projects, and avoid compatibility issues between dependencies.

Start by creating a virtual environment in your project directory:
Now you're ready to install 🤗 Transformers with the following command:

```bash
python -m venv .env
pip install transformers
```

Activate the virtual environment. On Linux and MacOs:
For GPU acceleration, install the appropriate CUDA drivers for [PyTorch](https://pytorch.org/get-started/locally) and TensorFlow(https://www.tensorflow.org/install/pip).

```bash
source .env/bin/activate
```
Activate Virtual environment on Windows
Run the command below to check if your system detects an NVIDIA GPU.

```bash
.env/Scripts/activate
```

Now you're ready to install 🤗 Transformers with the following command:

```bash
pip install transformers
nvidia-smi
```

For CPU-support only, you can conveniently install 🤗 Transformers and a deep learning library in one line. For example, install 🤗 Transformers and PyTorch with:
Expand Down Expand Up @@ -254,3 +245,36 @@ 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

See below for some of the more common installation issues and how to resolve them.

### Unsupported Python version

Ensure you are using Python 3.9 or later. Run the command below to check your Python version.

```
python --version
```

### Missing dependencies

Install all required dependencies by running the following command. Ensure you’re in the project directory before executing the command.

```
pip install -r requirements.txt
```

### Windows-specific

If you encounter issues on Windows, you may need to activate Developer Mode. 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
```