Skip to content

Commit 1f954e5

Browse files
updated ollama section to reflect new install instuctions
1 parent 2de1a05 commit 1f954e5

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

docs/jobs.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -298,32 +298,39 @@ salloc -N <number-of-nodes> -t <walltime> -p <partition>
298298

299299
**Step 1:**
300300

301-
Download the Ollama executable and start the server.
301+
Download and extract the Ollama packages and start the server.
302302

303303
```bash
304-
curl -L https://ollama.com/download/ollama-linux-amd64 --output ollama
305-
chmod a+x ollama
304+
mkdir <my-ollama-dir>
305+
cd <my-ollama-dir>
306+
307+
curl -LO https://ollama.com/download/ollama-linux-amd64.tgz
308+
tar -xzvf ollama-linux-amd64.tgz
309+
310+
curl -LO https://ollama.com/download/ollama-linux-amd64-rocm.tgz
311+
tar -xzvf ollama-linux-amd64-rocm.tgz
306312
```
307313

308-
If you are comfortable creating multiple terminal sessions on the compute same node, then simply run the serve command and open up a new terminal session on the same node to interact with the server.
314+
If you are comfortable creating multiple terminal sessions on the same compute node, then simply run the serve command and open up a new terminal session on the same node to interact with the server.
309315
```bash
310-
OLLAMA_MODELS=<path-to-store-models> ./ollama serve
316+
OLLAMA_MODELS=<path-to-store-models> ./bin/ollama serve
311317
```
312318

313319
Otherwise you can run the server in the background with optional logging as follows:
314320
```bash
315-
OLLAMA_MODELS=<path-to-store-models> ./ollama serve 2>&1 | tee log > /dev/null &
321+
OLLAMA_MODELS=<path-to-store-models> ./bin/ollama serve 2>&1 | tee log > /dev/null &
316322
```
323+
317324
```{note}
318-
By default, the models downloaded in Step 2 below will be saved in `~/.ollama`. However, your `$HOME` directory only has a storage capacity of 25GB and so can quickly fill up with larger models. Therefore, we recommend using the `OLLAMA_MODELS` evironment variable to change the directory where the models are saved to a location within your `$WORK` directory, which has a much larger capacity.
325+
By default, the models downloaded in Step 2 below will be saved in `~/.ollama`. However, your `$HOME` directory only has a storage capacity of 25GB and so can quickly fill up with larger models. Therefore, we recommend using the `OLLAMA_MODELS` environment variable to change the directory where the models are saved to a location within your `$WORK` directory, which has a much larger capacity.
319326
```
320327

321328
**Step 2:**
322329

323-
Ollama hosts a list of open-weight models available on their [site](https://ollama.com/library). In this example we will pull in the Llama3 8B model -- one of the most popular open-weight models released by [Meta](https://llama.meta.com/llama3/).
330+
Ollama hosts a list of open-weight models available on their [site](https://ollama.com/library). In this example we will pull in the Llama3.1 8B model -- one of the most popular open-weight models released by [Meta](https://llama.meta.com/llama3/).
324331

325332
```bash
326-
./ollama pull llama3
333+
./bin/ollama pull llama3.1:8b
327334
```
328335

329336
As described in Step 1, these models will be saved in the directory specified by using the `OLLAMA_MODELS` environment variable.
@@ -335,20 +342,23 @@ The Ollama server is OpenAI API compatible and uses port **11434** by default. T
335342
```bash
336343
curl http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" \
337344
-d '{
338-
"model": "llama3",
345+
"model": "llama3.1:8b",
339346
"messages": [
340347
{
341348
"role": "system",
342-
"content": "You are a helpful assistant."
349+
"content": "You are a helpful and very concise assistant."
343350
},
344351
{
345352
"role": "user",
346353
"content": "Why did the chicken cross the road?"
347354
}
348355
]
349356
}'
350-
{"id":"chatcmpl-318","object":"chat.completion","created":1717762800,"model":"llama3","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"The classic question!\n\nAccording to the most popular answer, the chicken crossed the road to get to the other side! But let's be honest, there are many creative and humorous responses to this question too.\n\nDo you have a favorite reason why the chicken might have crossed the road?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":28,"completion_tokens":57,"total_tokens":85}}
357+
```
351358

359+
Response:
360+
```bash
361+
{"id":"chatcmpl-331","object":"chat.completion","created":1761150510,"model":"llama3.1:8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Classic joke! The answer is: \"To get to the other side!\" Would you like a more creative or humorous take on it, though?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":32,"completion_tokens":30,"total_tokens":62}}
352362
```
353363

354364
Similarly, in Python, one can use the OpenAI Python package to interface with the Ollama server. To do so, you will first need to install the `openai` package in your user install directory or within a Python virtual environment.
@@ -364,13 +374,15 @@ Now you can use the Python OpenAI client to invoke your locally run Llama3 model
364374
from openai import OpenAI
365375
client = OpenAI(base_url="http://localhost:11434/v1", api_key="none")
366376
response = client.chat.completions.create(
367-
model="llama3",
377+
model="llama3.1:8b",
368378
messages=[{"role": "user", "content": "Hello this is a test"}],
369379
)
370380
print(response)
371381
```
382+
383+
Response:
372384
```
373-
ChatCompletion(id='chatcmpl-400', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content="Hello! This is indeed a test. I'm happy to be a part of it. How can I help you with your test?", role='assistant', function_call=None, tool_calls=None))], created=1717763172, model='llama3', object='chat.completion', system_fingerprint='fp_ollama', usage=CompletionUsage(completion_tokens=28, prompt_tokens=13, total_tokens=41))
385+
ChatCompletion(id='chatcmpl-782', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='This conversation just started, so no messages have been sent yet. What would you like to talk about or practice with me?', refusal=None, role='assistant', annotations=None, audio=None, function_call=None, tool_calls=None))], created=1761150781, model='llama3.1:8b', object='chat.completion', service_tier=None, system_fingerprint='fp_ollama', usage=CompletionUsage(completion_tokens=26, prompt_tokens=15, total_tokens=41, completion_tokens_details=None, prompt_tokens_details=None))
374386
```
375387

376388
**Step 4:**

0 commit comments

Comments
 (0)