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

common: use enums for sampler types #5418

Merged
merged 3 commits into from
Feb 11, 2024

Conversation

z80maniac
Copy link
Contributor

This PR does some refactoring of the code related to working with sampler names. Its main purpose is to prepare the code for adding sampling-seq to the server.

  1. Instead of raw characters representing a sampler, now enum is used. I think this makes the code more readable and type-safe.
  2. Sampler string parsing is now split into two functions: string_split and sampler_types_from_names. It was done because the latter function will also make parsing the sampler array for the server much easier.
  3. Moved all bindings between sampler type and its names in one place, e.g. from llama_sampling_order_print to sampler_type_to_name_string. It makes it less likely to miss something and also sampler_type_to_name_string may be used in the get_formated_generation for the server.
  4. The help info for --samplers now shows the actual default value, not the hard-coded example.

common/common.cpp Outdated Show resolved Hide resolved
z80maniac and others added 2 commits February 9, 2024 16:30
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
@ggerganov ggerganov merged commit a803333 into ggerganov:master Feb 11, 2024
47 of 53 checks passed
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
* common: use enums for sampler types

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* minor : spaces

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
* common: use enums for sampler types

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* minor : spaces

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
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.

2 participants