This guide is written and tested on a linux (Ubuntu) virtual machine.
Prerequisites: Make sure you have Python installed on your system. You can download Python from python.org.
If you don't have pip
installed, follow these steps:
- On Unix/macOS
sudo apt-get install python3-pip
- On Windows
python -m ensurepip --default-pip
Now, let's install venv and create a virtual environment for your project:
- Install venv
sudo apt install python3.10-venv
- On Unix/macOS/Windows
python3 -m venv venv
Activate the virtual environment based on your operating system:
- On Unix/macOS:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
You'll see the virtual environment name appear in your command prompt, indicating that it's now active.
Save your Access Token inside the .env
file:
HF_KEY=<your_access_token>
If you don't have access token, follow this guide to learn how to obtain your Hugging Face API Access Token
Now that you have your virtual environment set up, install the project dependencies using the provided requirements.txt file:
pip install -r requirements.txt
- If encountering out-of-memory issues, consider utilizing the following command for resolution.
pip install -r requirements.txt --no-cache-dir
Assuming you have a PDF document named "example.pdf" that you want to download into the "/home/ubuntu/pdfs" directory, you can use the wget command in the Linux terminal.
wget -O /home/ubuntu/pdfs/example.pdf https://example.com/path/to/example.pdf
This command will download the PDF file from the specified URL and save it as "example.pdf" in the "/home/ubuntu/Gemma-RAG/pdfs" directory.
python run.py
After you're done working on your project, you can deactivate the virtual environment:
deactivate