Skip to content

Commit

Permalink
quantize: override fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
phymbert committed Apr 20, 2024
1 parent deba48c commit 66a4b6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ bool parse_kv_override(const char * data, std::vector<llama_model_kv_override> &
} else if (strncmp(sep, "str:", 4) == 0) {
sep += 4;
kvo.tag = LLAMA_KV_OVERRIDE_TYPE_STR;
strncpy(kvo.str_value, sep, 128);
strncpy(kvo.str_value, sep, 127);
} else {
fprintf(stderr, "%s: invalid type for KV override '%s'\n", __func__, data);
return false;
Expand Down
4 changes: 2 additions & 2 deletions examples/quantize/quantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ int main(int argc, char ** argv) {
llama_model_kv_override kvo;
std::strcpy(kvo.key, LLM_KV_QUANTIZE_IMATRIX_FILE);
kvo.tag = LLAMA_KV_OVERRIDE_TYPE_STR;
strncpy(kvo.str_value, imatrix_file.c_str(), 128);
strncpy(kvo.str_value, imatrix_file.c_str(), 127);
kv_overrides.emplace_back(std::move(kvo));
}
if (!imatrix_dataset.empty()) {
llama_model_kv_override kvo;
std::strcpy(kvo.key, LLM_KV_QUANTIZE_IMATRIX_DATASET);
kvo.tag = LLAMA_KV_OVERRIDE_TYPE_STR;
strncpy(kvo.str_value, imatrix_dataset.c_str(), 128);
strncpy(kvo.str_value, imatrix_dataset.c_str(), 127);
kv_overrides.emplace_back(std::move(kvo));
}

Expand Down

0 comments on commit 66a4b6a

Please sign in to comment.