Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fixed potential memory leak in the load_model function , deleted se…
…micolons
  • Loading branch information
mendax0110 committed Sep 9, 2023
commit fb27a45f54831ec21440da51355c0eedc9d89d5c
3 changes: 3 additions & 0 deletions StarCoderApp/starcoderlib/generate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,9 @@ extern const StarcoderModel * load_model(const char * model_path) {

if (!starcoder_model_load(model_path, model->model, model->vocab)) {
fprintf(stderr, "%s: failed to load model from '%s'\n", __func__, model_path);

// free the mem, allocated for 'model' before returning
delete model;
return NULL;
}

Expand Down
6 changes: 3 additions & 3 deletions convert-hf-to-ggml.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ def bytes_to_unicode():
print(" Skipping variable: " + name)
continue

n_dims = len(data.shape);
n_dims = len(data.shape)

# ftype == 0 -> float32, ftype == 1 -> float16
ftype = 0;
ftype = 0
if use_f16:
if (name == "model/wte" or name == "model/lm_head" or name[-2:] == "/g" or name[-2:] == "/w") and n_dims == 2:
print(" Converting to float16")
Expand Down Expand Up @@ -201,7 +201,7 @@ def bytes_to_unicode():
fout.write(struct.pack("iii", n_dims, len(str), ftype))
for i in range(n_dims):
fout.write(struct.pack("i", data.shape[n_dims - 1 - i]))
fout.write(str);
fout.write(str)

# data
data.tofile(fout)
Expand Down