Conversation
A weight_map entry that points back at its own index, or at another index that points back, made parse_file recurse until the process was killed. Track indexes already being loaded and return a normal error instead.
Owner
|
Superseded by #2058. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2052
What changed and why
ModelLoader::parse_filetreats every.jsonpath as a safetensors index and then loads eachweight_mapshard throughparse_fileagain. An index whose shard path resolves to that same index (or to another index that refers back) never hits a missing-file error, so the loader logsusing safetensors index formatuntil the process is killed or overflows the stack.The loader now remembers the indexes it is already reading. A shard that resolves to one of those paths returns
cyclic safetensors index referenceand the convert command exits with status 1. A shard that is simply missing still reports the missing file.Verification
CPU build from
b167b94, matching the report:cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DSD_SERVER_BUILD_FRONTEND=OFF -DSD_WEBP=OFF -DSD_WEBM=OFF -DGGML_NATIVE=OFFsd-cli --mode converton three fixtures:{"weight_map":{"tensor":"model.safetensors.index.json"}}exits 1 after one load line andcyclic safetensors index reference.apointing atbandbpointing ataexits 1 after the two index load lines, with the same error..safetensorsfile still fails withcannot inspect model source 'missing.safetensors': No such file or directory.