To create an environment for working with Hugging Face’s Transformers library, start by creating a new Conda environment using
conda create --name llm_project_env
, then activate it with
conda activate llm_project_env
. Next, install the Transformers library by running
conda install transformers
. Launch Jupyter Notebook from within this environment using
jupyter notebook
, and you can begin writing Python code as usual. For example, you can use
from transformers import pipeline
and create a sentiment analysis pipeline with
pipeline("sentiment-analysis")
, then test it with a sentence like
"I love NLP!"
. Once you're done, deactivate the environment with
conda deactivate
.

Create an environment for Hugging Face’s Transformers library
- Create a new environment
> conda create --name llm_project_env
- Activate the new environment
> conda activate llm_project_env
- Install the packages you need
> conda install transformers
- Launch Jupyter within this environment
> jupyter notebook
- Start writing Python code as usual
from transformers import pipeline
sentiment = pipeline("sentiment-analysis")
sentiment("I love NLP!")
- Deactivate the environment
> conda deactivate


