This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
fix #149 - load tensors by type, ignoring filetype #152
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.
As noticed by @KerfuffleV2, both loaders incorrectly handle newer models that mix tensor types indiscriminately due to a confusion between the
ftype/f16_
and element type.I was planning on bringing #84 up to date first, but realised that I needed to figure out what was going on with
ftype
before baking that in.I've addressed the issue by decoupling them properly, and then switching over to loading the tensors from file instead of trying to preallocate them with the wrong type. This mirrors the changes made in ggerganov/llama.cpp#801.
I've tested this with Alpaca 7B GGML and
gpt4-x-alpaca-13b-native-4bit-128g
, the latter with and withoutmmap
, and all seems to work.I'm not happy at how I broke the isolation between the loader and the
Model
withModel::new_loader2
, but I'm going to revisit this once I remove loader1 as part of #150.loader1
is still broken (i.e. using the old behaviour), but that's OK because it's going away soon ^_^