llama_model_loader: ensure mappings vector has the expected size
This commit is contained in:
parent
7cbe1eac78
commit
9940df4f11
1 changed files with 2 additions and 0 deletions
|
@ -3175,6 +3175,8 @@ struct llama_model_loader {
|
||||||
|
|
||||||
void init_mappings(bool prefetch = true, std::vector<std::unique_ptr<llama_mlock>> * mlock_mmaps = nullptr) {
|
void init_mappings(bool prefetch = true, std::vector<std::unique_ptr<llama_mlock>> * mlock_mmaps = nullptr) {
|
||||||
if (use_mmap) {
|
if (use_mmap) {
|
||||||
|
mappings.reserve(files.size());
|
||||||
|
mmaps_used.reserve(files.size());
|
||||||
for (const auto & file : files) {
|
for (const auto & file : files) {
|
||||||
auto * mapping = new llama_mmap(file.get(), prefetch ? -1 : 0, ggml_is_numa());
|
auto * mapping = new llama_mmap(file.get(), prefetch ? -1 : 0, ggml_is_numa());
|
||||||
mmaps_used.emplace_back(std::make_pair(mapping->size, 0));
|
mmaps_used.emplace_back(std::make_pair(mapping->size, 0));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue