Hugging Face Transformers* one click lubuntu script
If you want to set up Hugging Face Transformers on a Lubuntu system with a one-click script, you can create a simple bash script that installs the necessary dependencies and sets up the environment. Here’s a step-by-step guide to create and run a script that achieves this:
### Step 1: Create the Installation Script
Open a terminal on your Lubuntu system and create a new script file. You can name it `install_transformers.sh`.
```bash
nano install_transformers.sh
```
### Step 2: Add the Following Script Content
Copy and paste the following content into the `install_transformers.sh` file:
```bash
#!/bin/bash
# Update the package list
echo "Updating package list..."
sudo apt update && sudo apt upgrade -y
# Install Python 3 and pip
echo "Installing Python 3 and pip..."
sudo apt install python3 python3-pip -y
# Optionally, install Python virtual environment
echo "Installing virtualenv..."
sudo apt install python3-venv -y
# Create a virtual environment (optional, but recommended)
echo "Creating a virtual environment named 'transformers_env'..."
python3 -m venv transformers_env
# Activate the virtual environment
source transformers_env/bin/activate
# Install Hugging Face Transformers and Torch
echo "Installing Hugging Face Transformers and PyTorch..."
pip install transformers torch
# Optionally, install additional packages like datasets or tokenizers
# Uncomment the next line if needed
# pip install datasets tokenizers
echo "Installation complete. To activate the virtual environment in the future, run 'source transformers_env/bin/activate'."
```
### Step 3: Make the Script Executable
After saving the script, make it executable by running:
```bash
chmod +x install_transformers.sh
```
### Step 4: Run the Script
Now you can run the script to install everything:
```bash
./install_transformers.sh
```
### Step 5: Activate the Virtual Environment Later
Every time you want to use Hugging Face Transformers, you need to activate the virtual environment you created:
```bash
source transformers_env/bin/activate
```
### Notes:
- This script updates your system, installs Python 3 and pip, and sets up a Python virtual environment for organizing your packages.
- It installs the `transformers` library from Hugging Face and PyTorch, which is a common backend for running models.
- You can uncomment the additional installations for `datasets` and `tokenizers` if you require them.
- Always ensure you have an active internet connection while running the script to download the packages.
### Disclaimer:
Be cautious while running scripts downloaded from the internet or created by others, as they can make changes to your system. Always inspect the script to ensure it meets your needs.


