Install Python 3:
sudo apt update
sudo apt install python3 python3-pip python3-venv
Create a virtual environment:
python3 -m venv chatbot_env
source chatbot_env/bin/activate
Install required libraries:
pip install transformers torch datasets accelerate
Install additional dependencies:
sudo apt install python3-dev build-essential
Install Jupyter Notebook (optional but useful):
pip install jupyter
Install Git:
sudo apt install git
Clone the Hugging Face transformers repository:
git clone https://github.com/huggingface/transformers.git
Install additional Hugging Face libraries:
pip install tokenizers sentencepiece sacremoses
Test your setup:
from transformers import pipeline
classifier = pipeline("sentiment-analysis")
result = classifier("Hello, world!")
print(result)
Remember to activate your virtual environment (source chatbot_env/bin/activate
) whenever you’re working on your chatbot project. This setup provides a solid foundation for developing Hugging Face chatbots on Ubuntu.