PolarionCopilot is a combination of two main codes:
- A Polarion workitem retrieval script.
- A Copilot script to use the workitems.
The installation is half-manual, half-automated.
The manual part is the installation of the required software.
The automated part is the installation of each library, and specific changes done to them.
- Python (3.8+): Python for Windows
- Make sure to check the box "Add python.exe to PATH" during the installation
- Git, if it isn't already installed, to clone this repository: Git
- You can click Next for each step.
- [Optional] A good terminal to have a more user-friendly experience.
- You can use the new Windows Terminal for exemple: Windows Terminal
- Python (3.8+):
sudo apt-get install python3 python3-venv
- Git, if it isn't already installed, to clone this repository:
sudo apt-get install git
Using a virtual environment is a good practice to avoid conflicts between libraries and versions.
Also to keep your main Python installation clean.
- Find a suitable location for the repository
cd \your\directory\
- Create and activate the virtual environment
If you run into an error with execution policy, check your own execution policy with:
python -m venv .venv .\.venv\Scripts\activate
remember it if you want to put it back later. Then, change it to RemoteSigned and try to activate the environment again:Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
- Clone the repository
git clone https://github.com/WH-Yoshi/PolarionCopilot.git cd PolarionCopilot
- Install the required libraries
pip install -r requirements.txt
- Find a suitable location for the repository
cd /your/directory/
- Clone the repository
git clone https://github.com/WH-Yoshi/PolarionCopilot.git cd PolarionCopilot
- Install the required libraries
sh install_polarioncopilot.sh
Create and fill the .env file with the following content, each value must be between quotes "":
base_url=<URL> # The URL of your Polarion server (e.g. https://polarion.example.com/polarion)
embedding_api=<URL> # The URL of your embedding API
openai_api=<URL> # The URL of your OpenAI like API (has to finish with "/v1")
polarion_user=<USERNAME> # The username to access the Polarion server
polarion_password=<PASSWORD> # The password to access the Polarion server [Not recommended]
polarion_token=<TOKEN> # The user token to access the Polarion server
Replace <URL>
, <USERNAME>
, and <TOKEN>
(or <PASSWORD>
) with your own values.
The '.env' file contains sensitive information, make sure to not share it.
-
Open TensorDock
-
Get two VM with one GPU each
- 48GB VRAM, 8GB or RAM, 2CPUs and 50GB SSD
- 16GB VRAM, 8GB or RAM, 2CPUs and 30GB SSD
-
Select one of the available locations
-
Choose Ubuntu 22.04 as an operating system
-
Deploy
-
SSH into the machine :
ssh -p xxxxx user@host -i ~/.ssh/id_rsa_tensordock
-
Run the two docker images :
docker run -d --gpus all -v ~/.cache/huggingface:/root/.cache/huggingface --env "HUGGING_FACE_HUB_TOKEN=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" -p 8000:8000 --ipc=host vllm/vllm-openai:latest --model mistralai/Mistral-7B-Instruct-v0.3
docker run -d --gpus all -p 8080:80 -v $PWD/data:/data --pull always ghcr.io/huggingface/text-embeddings-inference:86-1.5 --model-id dunzhang/stella_en_1.5B_v5
-
Create a ssh key (without password)
ssh-keygen -t rsa -b 4096
-
Copy/Paste the pub key in TensorDock SSH
-
Add the private key to your ssh agent
ssh-add ~/.ssh/id_rsa_tensordock
We use an SSH key to automatically establish an SSH tunnel to the remote server without needing to enter a password.
Warning: You must have created the container by pulling the images on point 7.
This step is optional but recommended to avoid having to restart the containers manually after a reboot.
It will start all the containers that are stopped.
- Create a new file in /etc/systemd/system/ :
sudo nano /etc/systemd/system/containers.service
- Fill the file with the following content :
[Unit] Description=Starts all containers service After=network.target Requires=docker.service [Service] Type=oneshot ExecStart=/bin/sh -c '/usr/bin/docker start $(/usr/bin/docker ps -aq)' ExecStop=/bin/sh -c '/usr/bin/docker stop $(/usr/bin/docker ps -aq)' RemainAfterExit=true
- Reload the daemon and enable the service to start at boot :
sudo systemctl daemon-reload sudo systemctl enable containers
Now you can restart the virtual machine without having to restart the containers manually.
To manage the creation of SSH tunnels whenever the remote server is powered on, we have developed a script that checks if it's possible to establish SSH tunnels for both the Embedding and Mistral machines. This script is designed to run in a Linux screen.
- Script location
./PolarionCopilot/codes/ssh_helper/ssh_handler.sh
- Run the linux screen.
screen -S ssh_handler -d -m /bin/bash /path/to/ssh_handler.sh
- Run the desired script in the main directory:
python run_polarion.py python run_copilot.py
python3 run_polarion.py python3 run_copilot.py
- Enjoy the ride!