[GH-ISSUE #1763] Resuming to pull a model is not working via API #47524

Closed
opened 2026-04-28 04:05:51 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @DennisKo on GitHub (Jan 2, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/1763

If I start to pull a model via /api/pull and then abort the request at let's say 2% and re-request it, it will not resume and start from 0%.
If I do it via ollama pull model it correctly resumes....

Did some more testing:
Start via /api/pull, go to 2%, abort -> run ollama pull model, no resume...
Start via ollama pull model, go to 2%, abort -> hit /api/pull, it resumes...

latest version, macos

Originally created by @DennisKo on GitHub (Jan 2, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/1763 If I start to pull a model via `/api/pull` and then abort the request at let's say 2% and re-request it, it will not resume and start from 0%. If I do it via `ollama pull model` it correctly resumes.... Did some more testing: Start via `/api/pull`, go to 2%, abort -> run `ollama pull model`, no resume... Start via `ollama pull model`, go to 2%, abort -> hit `/api/pull`, it resumes... latest version, macos
GiteaMirror added the bug label 2026-04-28 04:05:51 -05:00
Author
Owner

@technovangelist commented on GitHub (Jan 3, 2024):

hi @DennisKo, this is an interesting one. Thanks for reporting it. We will investigate this further. Were you testing this with the same model in both cases?

<!-- gh-comment-id:1874755924 --> @technovangelist commented on GitHub (Jan 3, 2024): hi @DennisKo, this is an interesting one. Thanks for reporting it. We will investigate this further. Were you testing this with the same model in both cases?
Author
Owner

@DennisKo commented on GitHub (Jan 3, 2024):

Yes, same model mistral. I am aborting both via a simple kill command (ctrl+c) in both cases. There is no abort controller in my fetch('/api/pull') implementation...

<!-- gh-comment-id:1875349104 --> @DennisKo commented on GitHub (Jan 3, 2024): Yes, same model `mistral`. I am aborting both via a simple kill command (ctrl+c) in both cases. There is no abort controller in my `fetch('/api/pull')` implementation...
Author
Owner

@pdevine commented on GitHub (Jan 4, 2024):

@DennisKo can you post the logs from the server for the POST /api/pull request? Specifically there should be something that looks like:

downloading <digest> in X Y MB part(s)

I just tested this and the resume functionality appears to be working correctly. I tried repulling a partially downloaded model, then hit Ctrl-C, and then started it again using the same command. Here's the output:

% curl -X POST http://localhost:11434/api/pull -d '{"name": "mixtral:8x7b-instruct-v0.1-q8_0"}'
{"status":"pulling manifest"}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349616788}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8350818181}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8351762955}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8352549760}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8353061866}
{"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8353622270}

You can see it takes a moment before it starts getting the correct new data, but it does resume from the correct location, and it starts pulling new data.

<!-- gh-comment-id:1876177962 --> @pdevine commented on GitHub (Jan 4, 2024): @DennisKo can you post the logs from the server for the `POST /api/pull` request? Specifically there should be something that looks like: `downloading <digest> in X Y MB part(s)` I just tested this and the resume functionality appears to be working correctly. I tried repulling a partially downloaded model, then hit Ctrl-C, and then started it again using the same command. Here's the output: ``` % curl -X POST http://localhost:11434/api/pull -d '{"name": "mixtral:8x7b-instruct-v0.1-q8_0"}' {"status":"pulling manifest"} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349530240} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8349616788} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8350818181} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8351762955} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8352549760} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8353061866} {"status":"pulling d68d6a651780","digest":"sha256:d68d6a65178011b746d215273d6a1f607f78be24a53532cf99618a32c2f382a2","total":49625198848,"completed":8353622270} ``` You can see it takes a moment before it starts getting the correct new data, but it does resume from the correct location, and it starts pulling new data.
Author
Owner

@DennisKo commented on GitHub (Jan 4, 2024):

I actually got confused with my test setup it seems. It was not because of the difference of api or cli, it was the way I was aborting AND killing the API server (ollama serve).
So new situation is: if I kill the API server, restart it and try to resume it does not work. Is this even a bug then? Or is that expected?

<!-- gh-comment-id:1876858525 --> @DennisKo commented on GitHub (Jan 4, 2024): I actually got confused with my test setup it seems. It was not because of the difference of api or cli, it was the way I was aborting AND killing the API server (`ollama serve`). So new situation is: if I kill the API server, restart it and try to resume it does not work. Is this even a bug then? Or is that expected?
Author
Owner

@pdevine commented on GitHub (Jan 5, 2024):

This is actually expected. The API server cleans up all of the partially downloaded images every time it restarts. You should be able to turn this off by setting OLLAMA_NOPRUNE=1 when you start the server.

<!-- gh-comment-id:1877946144 --> @pdevine commented on GitHub (Jan 5, 2024): This is actually expected. The API server cleans up all of the partially downloaded images every time it restarts. You should be able to turn this off by setting `OLLAMA_NOPRUNE=1` when you start the server.
Author
Owner

@DennisKo commented on GitHub (Jan 5, 2024):

This is actually expected. The API server cleans up all of the partially downloaded images every time it restarts. You should be able to turn this off by setting OLLAMA_NOPRUNE=1 when you start the server.

Ah nice, I could not find anything about that.

In my quick tests with OLLAMA_NOPRUNE it still had problems with resuming if you shut down the server with a SIGINT. If I abort the API request via a proper client abort at least once, it correctly resumes, even after a server restart.

But I guess that's a different issue ...

<!-- gh-comment-id:1879134774 --> @DennisKo commented on GitHub (Jan 5, 2024): > This is actually expected. The API server cleans up all of the partially downloaded images every time it restarts. You should be able to turn this off by setting `OLLAMA_NOPRUNE=1` when you start the server. Ah nice, I could not find anything about that. In my quick tests with `OLLAMA_NOPRUNE` it still had problems with resuming if you shut down the server with a `SIGINT`. If I abort the API request via a proper client abort at least once, it correctly resumes, even after a server restart. But I guess that's a different issue ...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#47524