This repository handle the protocolRecomender tool. An index map with all the embedding vector with the descriptions of all protocols is created by the indexGenerator.py and the recomendations based on a user question and the index map is provided by the main.py script.
An index map (numpy array) and a JSON file with the map for the index will be generated
-
Install
ollamain the system, install ollama in the scipion enviroment (to comunicate python with ollama) and pull the model:curl -fsSL https://ollama.com/install.sh | sh ollama serve ollama pull deepseek-r1:14b ollama list conda activate scipionProtocolRecomender pip install ollamamodels located at .ollama/models/blob
model = "deepseek-r1:14b" model = "deepseek-r1:32b" model = "deepseek-r1:671b"
HuggingFaceEmbeddings Pythorch things in the enviroment:
conda install pytorch torchvision torchaudio cudatoolkit -c pytorchpip install langchain_huggingface
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
pip install -qU langchain-huggingfacemodel_name="sentence-transformers/all-mpnet-base-v2"
faiss-cpu numpy
A Scipion enviroment has to be created. The script can install all the plugins of Scipion, takes all the protocol, embedd all of them and save it in an index map (numpy array) and a json file with the plugin-protocol-index references.
An Scipion enviroment with Scipion installed:
python3 -m scipioninstaller -conda -n scipionProtocolRecomender -noAsk scipionProtocolRecomender- In terminal, activate the enviroment
- Maybe you need to update the compilers in the conda scipion env:
scipion3 run conda install -c conda-forge libstdcxx-ng- Edit the parameters to prepare the enviroment:
- SCIPION_ENVIROMENT_NAME
- PATH_SCIPION_INSTALLED
- SITE_PACKAGES
- If INSTALL_PLUGINS is True will install all the plugins
- Goes to the path the Scipion is installed
- Activate ollama
ollama serve- Launch the script with:
python3 indexGenerator.py- os
- pathlib
- requests
- subprocess
- json
- numpy
- ollama (see main section to how to install)
- model 43GB: model = "deepseek-r1:70b"
- model 404GB model = "deepseek-r1:671b"