The main purpose of this project is to generate titles from work items descriptions from Polarion using Mistral.
This script is a combination of 2 main components for Windows :
- A python script that get and send Polarion work items to a LLM.
- A LLM that can be used to rephrase Titles from work items.
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.
(You also need a /certif repo in the root path of the project with a ca-certificate for polarion webservice.)
- 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
- Python, minimum version 3.8.10
- Make sure to check the box "Add python.exe to PATH" during the installation.
- Git, to cline this repository: Git
- You can click Next for each step
Using a virtual environment is a good practice to avoid conflicts between libraries and versions. And also to keep your main Python installation clean.
- Find a suitable location for the repository
cd <DIRECTORY>
- Create and activate the virtual environment
If you run into an error with execution policy, check your own execution policy with:
py -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://gitlab.sw.goiba.net/req-test-tools/polarion-copilot/title_copilot.git cd title_copilot - 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://gitlab.sw.goiba.net/req-test-tools/polarion-copilot/title_copilot.git cd title_copilot
- Fill the .env file with the following content, each value must be between quotes "" (the .env file is located at the
root path of the project) :
Replace
base_url=<URL> # The URL of your Polarion server (e.g. https://polarion.example.com/polarion) openai_api=<URL> # The URL of your OpenAI like API (has to finish with "/v1") # It depends on which server you want to modify work items titles. polarion_url_dev=<URL> polarion_user=<USERNAME> # The username to access the Polarion server polarion_password=<PASSWORD> # The password to access the Polarion server polarion_token=<TOKEN> # The user token to access the Polarion server
<URL>,<USERNAME>, and<TOKEN>with your own values. .env file contains sensitive information, make sure to not share it.
- Open TensorDock
- Get a GPU with at least 48Gb of VRAM
- 1GPU, 8Gb of RAM, 2CPU and 30Gb SSD
- Select one of the available locations
- Choose Ubuntu as operating system
- Put a password and a machine name
- Deploy
- SSH into the machine :
ssh -p xxxxx user@host -L 22027:localhost:8080 -L 22028:localhost:8000
- Run the two docker images :
docker run -d --gpus all -v ~/.cache/huggingface:/root/.cache/huggingface --env "HUGGING_FACE_HUB_TOKEN=<secret>" -p 8000:8000 --ipc=host vllm/vllm-openai:latest --model mistralai/Mistral-7B-Instruct-v0.2 --max-model-len 2048
docker run -d --gpus all -p 8080:80 -v $PWD/data:/data --pull always ghcr.io/huggingface/text-embeddings-inference:1.2 --model-id intfloat/multilingual-e5-large-instruct - 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_tensordockWe 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 9. When the two images are booted up, you can proceed.
- 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 start the service :
sudo systemctl daemon-reload sudo systemctl start containers
- Now you can restart the virtual machine without having to restart the containers manually.
- Run the launcher for title copilot
py run_app.py
- Enjoy the ride!