Last active
May 9, 2024 20:02
-
-
Save jrbourbeau/f20963f1d7f04a3412fe38927eb76bad to your computer and use it in GitHub Desktop.
Ollama on Coiled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import coiled | |
import ollama | |
from distributed import print | |
@coiled.function(name="ollama") | |
def chat(): | |
model = "llama3:latest" | |
print(f"Pulling {model} model...") | |
ollama.pull(model) | |
print(f"Done pulling {model}") | |
stream = ollama.chat( | |
model=model, | |
messages=[{"role": "user", "content": "Why is the sky blue?"}], | |
stream=True, | |
) | |
for chunk in stream: | |
print(chunk["message"]["content"], end="", flush=True) | |
chat() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
curl https://ollama.ai/install.sh | sh | |
export OLLAMA_HOST="0.0.0.0" | |
ollama serve |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment