5. Change Context Window for model

01 Context Window legnths

Can't find the docs for this Hermes website,

I found it! NOTE TO SELF:, use search bar in docs on herems nousportal site , I found it here https://hermes-agent.nousresearch.com/docs/guides/local-ollama-setup

Ollama by default only runs a 24,000 context legnth, we need to change it to 64,000

To change Context Window Length, we create a Modelfile

# Create a Modelfile that extends context
cat > ~/.hermes/cache/scratch/Modelfile << 'EOF'
FROM gemma4:31b
PARAMETER num_ctx 64000
EOF

ollama create gemma4-64k -f ~/.hermes/cache/scratch/Modelfile

02 Change Context Window, create Modelfile

This is where the Variant is created to copy model with correct context window size with new name

Open the termainl and paste in the following string ,

printf 'FROM gemma4:e4b\nPARAMETER num_ctx 64000\n' > /tmp/gemma4e-64k.Modelfile && ollama create gemma4e-64k -f /tmp/gemma4e-64k.Modelfile

To see the model copy Variant type

ollama list

03 ollama ps not showing Variant

the Variant is not appearing when i type in

ollama ps

But it shows up in tutorial, so **WARNING might be a problem

03 Change Ollama default Context Window

Change context size in ollama settings, but, it changes it for all models in ollama. The Modelfile only changes specified model,

To do so this tutorial assumes you have ollama installed,, i'm staying on this page in ollama , it gave me a key i saved, i'm going to come back here after next lesson to make sure i have everyting correct in ollama setup,

But it shows up in tutorial, so **WARNING might be a problem