Skip to content

examples : add llama_init_from_gpt_params() common function to reduce duplicate code #1290

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

Merged
merged 1 commit into from
May 2, 2023

Conversation

deadprogram
Copy link
Contributor

This PR modifies the examples to reduce duplicate code, by adding a new load_model_from_file() common function.

Consider this both a reduction of lines of code in the examples, and also a step towards #508

// Model utils
//

struct llama_context * load_model_from_file(gpt_params & params);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
struct llama_context * load_model_from_file(gpt_params & params);
struct llama_context * llama_init_from_gpt_params(const gpt_params & params);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name changed, and branch rebased/pushed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument should be const reference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Fixed.

@deadprogram deadprogram force-pushed the example-refactor-to-common branch from e983ec4 to d08f53c Compare May 2, 2023 20:17
@deadprogram deadprogram changed the title examples : add load_model_from_file() common function to reduce duplicate code examples : add llama_init_from_gpt_params() common function to reduce duplicate code May 2, 2023
…y all examples to use it, in order to reduce duplicate code

Signed-off-by: deadprogram <[email protected]>
@deadprogram deadprogram force-pushed the example-refactor-to-common branch from d08f53c to a032ac5 Compare May 2, 2023 20:31
@ggerganov ggerganov merged commit 67c7779 into ggml-org:master May 2, 2023
DannyDaemonic pushed a commit to DannyDaemonic/llama.cpp that referenced this pull request May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants