Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⭐️ Feat: consider using Ollama's new unload / stop command for unloading #115

Open
sammcj opened this issue Sep 19, 2024 · 0 comments
Open
Assignees
Labels

Comments

@sammcj
Copy link
Owner

sammcj commented Sep 19, 2024

Description

consider using Ollama's new unload / stop command for unloading

their docs:


List which models are currently loaded

ollama ps

Stop a model which is currently running

ollama stop llama3.1

Unload a model

If an empty prompt is provided and the keep_alive parameter is set to 0, a model will be unloaded from memory.

Request
curl http://localhost:11434/api/generate -d '{
  "model": "llama3.1",
  "keep_alive": 0
}'
Response

A single JSON object is returned:

{
  "model": "llama3.1",
  "created_at": "2024-09-12T03:54:03.516566Z",
  "response": "",
  "done": true,
  "done_reason": "unload"
}

Unload a model

If the messages array is empty and the keep_alive parameter is set to 0, a model will be unloaded from memory.

Request
curl http://localhost:11434/api/chat -d '{
  "model": "llama3.1",
  "messages": [],
  "keep_alive": 0
}'
Response

A single JSON object is returned:

{
  "model": "llama3.1",
  "created_at":"2024-09-12T21:33:17.547535Z",
  "message": {
    "role": "assistant",
    "content": ""
  },
  "done_reason": "unload",
  "done": true
}
@sammcj sammcj added the feature label Sep 19, 2024
@sammcj sammcj self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant