- Install and use a medical GPT chat with custom model files and model downloads from Hugging Face.
- Run a Mistral programming code generation GPT chat from Ollama's library provided by default.
- Have a fast, modern PC (best with NVIDIA CUDA support and >= 12 GB graphics RAM), have patience, or use an M1 Mac or an AI web hosting with available GPU (e.g., Azure).
- Install Ollama: https://ollama.com - install for your system.
- Choose the models for your domain: https://ollama.com/library.
- Note: Mistral is no longer available in German by default.
- Run
ollama run mistral
to download the model and run it. Example prompt:Schreibe mir einen Python Flask Server, der ein Hello World zurück gibt
. - For German, use the custom model from: https://huggingface.co/TheBloke/em_german_leo_mistral-GGUF.
- Run
- Bookmark the Ollama terminal in MacOS Dock / Windows taskbar.
- Check in a terminal:
ollama -v
. ollama list
lists the installed models./?
for help.ollama rm <Modelname>
deletes an installed model.- Exit command line chat by typing:
/bye
.
- For MacOS M1 SOC GPU (no CUDA for PC & Linux): https://huggingface.co/search/full-text?q=health+gguf&type=model.
- Download and install via model file first, then run:
ollama run biomistral1
(7B - German). Example prompt:Was ist der Haupt-Wirkstoff in Aspirin?
.
- To use Ollama as a Python Chainlit chat, follow these steps. Result can be seen in the following screenshot:
- Install Miniconda first: https://docs.conda.io/en/latest/miniconda.html.
- Then run:
conda create --name torch python=3.9 conda activate torch pip install -r ./langchain-gemma-ollama-chainlit/requirements.txt python -m ipykernel install --user --name torch --display-name "Python 3.9 (torch)" pip install transformers==4.20.0 pip install googletrans==4.0.0-rc1 (optional) conda install torch -c pytorch-nightly
- if using conda:
conda install pytorch torchvision torchaudio -c pytorch-nightly
- or with pip:
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
-
Create new env from Jeff Heaton Youtube / Github pages
-
other: https://www.youtube.com/results?search_query=jeff+heaton+pytorch+installation
-
activate env by typing in console:
-
conda activate torch
- In case a model is not listed on https://ollama.com/library:
- First install the huggingface-cli:
python -m pip install -U "huggingface_hub[cli]"
pip3 install huggingface-hub
- Load the model file to local cache (danger, have at least 6 GB of free space):
huggingface-cli download BioMistral/BioMistral-7B-GGUF ggml-model-Q8_0.gguf --local-dir . --local-dir-use-symlinks False
ollama create biomistral1 -f Modelfile
ollama run biomistral1
cd langchain-gemma-ollama-chainlit
change directory- replace in langchain-gemma-ollama-chainlit-de.py:
model = Ollama(model="gemma:2b")
- instead of gemma:2b with your model name e.g.mistral
or custom installationbiomistral1
. - edit Modefile with correct template
ollama create biomistral1 -f Modelfile
- Create the ollama file from custom model:
- (you can initialize, in case of manifest missing error do a
ollama run mistral
first)
cd langchain-gemma-ollama-chainlit
change directorychainlit run langchain-gemma-ollama-chainlit-de.py
-> medicalchainlit run langchain-mistral-ollama-chainlit.py
-> code
- show llms:
cd ~/.cache/huggingface/hub
ls -lia
python -m pip install -U "huggingface_hub[cli]"
- start removing llms:
huggingface-cli delete-cache
- select via
Space
- don't select no action then enter und chooseY
(es)
- What are the symptoms of the common cold?
- What causes the seasonal flu?
- What medication would be prescribed for a headache?
- Was sind die Symptome einer Erkältung?
- Was verursacht die saisonale Grippe?
- Welche Medikamente würden gegen Kopfschmerzen verschrieben?
- Wie importiert man ein Package in Java?
- Wie definiert man einen Type mit einem String und einem boolean in Typescript?
- Schreibe mir einen Python Flask Server, der ein Hello World zurück gibt