Skip to content

Instantly share code, notes, and snippets.

@lvnilesh
Last active July 28, 2024 19:17
Show Gist options
  • Save lvnilesh/a28f19d11754e99e5a0140ed2e069217 to your computer and use it in GitHub Desktop.
Save lvnilesh/a28f19d11754e99e5a0140ed2e069217 to your computer and use it in GitHub Desktop.
llama llama red pajama
# a machine with a GPU would be nice. makes it faster.
# install Ollama - a runner for the models
sudo curl -L https://ollama.com/download/ollama-linux-amd64 -o /usr/bin/ollama
sudo chmod +x /usr/bin/ollama
sudo useradd -r -s /bin/false -m -d /usr/share/ollama ollama
# create service unit file
tee /usr/lib/systemd/system/ollama.service > /dev/null <<EOF
[Unit]
Description=Ollama Service
After=network-online.target
[Service]
ExecStart=/usr/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="OLLAMA_HOST=0.0.0.0"
Environment="OLLAMA_ORIGINS=*"
[Install]
WantedBy=default.target
EOF
# reload the systemd daemon and enable ollama
sudo systemctl daemon-reload
sudo systemctl enable ollama
sudo systemctl start ollama
# testing
sudo lsof -i :11434
sudo systemctl stop ollama
export OLLAMA_HOST=0.0.0.0
ollama serve
# run the llama3.1 model
ollama run llama3.1
# restart the ollama runner
sudo service ollama restart
# watch the logs
journalctl -xeu ollama
# watch nvidia GPU
watch -n 1 nvidia-smi
# DeepSeek Coder is trained from scratch on both 87% code and 13% natural language in English and Chinese. Each of the models are pre-trained on 2 trillion tokens.
### Models available
ollama run deepseek-coder
ollama run deepseek-coder:6.7b
ollama run deepseek-coder:33b
### API access to your own machine
Example using curl:
curl -X POST http://your-machine-ip-address:11434/api/generate -d '{
"model": "llama3.1",
"prompt":"Why is the sky blue?"
}'
# Enchanted App on iOS app store
http://your-machine-ip-address:11434
# zed editor integrates personal ollama
# vscode editor integration with personal ollama
# obsidian notes integration via khoj plugin connected to personal ollama
@lvnilesh
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment