common: fix split model loading by sorting file list#21535
common: fix split model loading by sorting file list#21535brettp wants to merge 1 commit intoggml-org:masterfrom
Conversation
|
@ggerganov - Just a heads up the github-actions bot mislabeled this as a test. This does include a test, but primarily it fixes a reproducible bug in split model loading. |
|
Hi @angt - Thanks for the response. #21019 did not address cases when llama-server is started in offline mode and the FS returns the split files out of order. In my case, this was after I had to relocate the HF cache dir. Here's a quick demo built from this morning's latest master: This could be quirk of MacOS, but the included test demonstrates this behavior by writing the files out of order and forcing offline mode. It currently fails on master. |
File order is not guaranteed when listing dirs. In offline mode, files are not sorted when read from cache, which can result in the wrong part loading first if the files have changed metadata (e.g., by moving, symlinking, etc). This is a minimal approach to ensure model files are correctly sorted when downloaded or loaded from cache, in online or offline mode. Tests are included. Disclaimer: An AI agent was used to refine the approach and write the test. refs: ggml-org#21019 ggml-org#21016
ede0917 to
c620659
Compare
|
Can you test with master if it's still an issue ? |
|
IMO it might be more convenient if |
Overview
Fix split model loading from cache in offline mode.
Refs: #21019 #21016
Additional information
File order is not guaranteed when listing dirs. In offline mode, files are not sorted when read from cache, which can result in the wrong part loading first if the files have changed metadata (e.g., by moving, symlinking, etc).
This is a minimal approach to always sort model parts so the correct part is loaded first when downloaded or loaded from cache, in online or offline mode.
A test is included, but can be relocated if not in the best spot since it introduces additional dependencies in
tests/test-gguf-model-data.cpp.Requirements