Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed potential memory leak, deleted unnecessary semicolon #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
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