llama: initialize f16 tables in quantize c api.

This commit is contained in:
Yaohui Liu 2023-05-20 00:32:08 +08:00
parent 5ea4339273
commit 484f6e9438
No known key found for this signature in database
GPG key ID: E86D01E1809BD23E
2 changed files with 6 additions and 7 deletions

View file

@ -52,13 +52,6 @@ int main(int argc, char ** argv) {
return 1;
}
// needed to initialize f16 tables
{
struct ggml_init_params params = { 0, NULL, false };
struct ggml_context * ctx = ggml_init(params);
ggml_free(ctx);
}
// parse command line arguments
const std::string fname_inp = argv[1];
std::string fname_out;

View file

@ -2198,6 +2198,12 @@ int llama_model_quantize(
enum llama_ftype ftype,
int nthread) {
try {
// needed to initialize f16 tables
{
struct ggml_init_params params = { 0, NULL, false };
struct ggml_context * ctx = ggml_init(params);
ggml_free(ctx);
}
llama_model_quantize_internal(fname_inp, fname_out, ftype, nthread);
return 0;
} catch (const std::string & err) {