ollama running it in google colab

You can easily run ollama in google colab by following these steps

!apt-get update

!apt-get install -y curl wget gnupg

!curl -fsSL https://ollama.com/install.sh | sh

!nohup ollama serve &

!ollama pull llama3.2

!ollama run llama3.2 "Why is the sky blue?"

What if you want to use the REST API chat mode? That is supported to 

!curl http://localhost:11434/api/chat -d '{ "model": "llama3.2", "messages":

[ { "role": "user", "content": "why is the sky blue?" }  ]}'

So is the generate mode 

!curl http://localhost:11434/api/generate -d
'{"model": "llama3.2", "prompt":"Why is the sky blue?"}'

Example google colab notebook can be found here

https://github.com/mitzenjeremywoo/google-colab-notebooks/blob/main/ollama_in_google_colab.ipynb

Comments

Popular posts from this blog

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type