Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| habrok:examples:llms [2025/03/05 12:26] – camarocico | habrok:examples:llms [2026/02/26 13:23] (current) – fokke | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Running LLMs ===== | ===== Running LLMs ===== | ||
| - | If you want to run a Large Language Model (LLM) on Habrok, here's one possible and relatively easy way to do it. | + | If you want to run a Large Language Model (LLM) on Habrok, here's one possible and relatively easy way to do it. Note that the versions are recent as of 26 February 2026. |
| - | 1. Login with your account on Habrok. | + | ==== Installation ==== |
| - | < | + | |
| - | 2. Start an interactive job on an A100 node (single GPU): | + | 1. Login with your account on Habrok |
| - | < | + | < |
| + | |||
| + | 2. Since the vllm installation packages require a newer glibc than our operating system provides, we will switch to the EESSI software stack. This provides a compatability layer with a newer glibc. | ||
| + | < | ||
| - | 3. Load the Python | + | 3. Load the Python |
| - | < | + | < |
| 4. Create a virtual environment (only once): | 4. Create a virtual environment (only once): | ||
| Line 18: | Line 20: | ||
| < | < | ||
| - | 6. Upgrade '' | + | 6. Upgrade '' |
| - | < | + | < |
| 7. Install '' | 7. Install '' | ||
| Line 25: | Line 27: | ||
| Might take a bit the first time. | Might take a bit the first time. | ||
| - | 8. Run '' | + | ==== Running through an interactive job ==== |
| + | |||
| + | 1. Start an interactive job on an A100 node (single GPU) to be able to run the software: | ||
| + | < | ||
| + | |||
| + | 2. Switch to the EESSI software stack | ||
| + | < | ||
| + | |||
| + | 3. Load the Python module you used for installation | ||
| + | < | ||
| + | |||
| + | 4. Activate the venv you created earlier: | ||
| + | < | ||
| + | |||
| + | 5. Run '' | ||
| < | < | ||
| explanations of some of the parameters: | explanations of some of the parameters: | ||
| Line 75: | Line 91: | ||
| ] | ] | ||
| }</ | }</ | ||
| + | |||
| + | ==== Running Ollama in a jobscript ==== | ||
| + | |||
| + | The following code can be used in a jobscript to run an Ollama model: | ||
| + | |||
| + | < | ||
| + | # Load the Ollama module | ||
| + | # GPU node | ||
| + | module load ollama/ | ||
| + | # CPU node | ||
| + | # module load ollama/ | ||
| + | |||
| + | # Use /scratch for storing models | ||
| + | export OLLAMA_MODELS=/ | ||
| + | |||
| + | # Start the Ollama server in the background, log all its output to ollama-serve.log | ||
| + | ollama serve >& ollama-serve.log & | ||
| + | # Wait a few seconds to make sure that the server has started | ||
| + | sleep 5 | ||
| + | |||
| + | # Run the model | ||
| + | echo "Tell me something about Groningen" | ||
| + | |||
| + | # Kill the server process | ||
| + | pkill -u $USER ollama | ||
| + | </ | ||