Installing the Transformers framework is divided into the following steps:
- Environmental Preparation:Requires Python 3.9+ environment, recommended virtual environment
- Create a virtual environment:
Windows.python -m venv transformers_env
Linux/Mac.source transformers_env/bin/activate - Foundation Installation:
pip install transformers - Optional mounting:
Development Edition:pip install git+https://github.com/huggingface/transformers
GPU support: CUDA driver required
Verify that the installation can execute the following test code:
from transformers import pipeline
print(pipeline('sentiment-analysis')('hugging face is awesome'))
The expected output is similar: {'label': 'POSITIVE', 'score': 0.9998}
This answer comes from the articleTransformers: open source machine learning modeling framework with support for text, image and multimodal tasksThe































