Skip to content

Commit

Permalink
refactor: enum class
Browse files Browse the repository at this point in the history
  • Loading branch information
sangjanai committed May 8, 2024
1 parent e67f29b commit adc53c9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/llama_client_slot.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ static bool server_verbose = false;

using json = nlohmann::json;

// TODO: can become bool if we can't find use of more states
enum class SlotState {
enum class SlotState: uint8_t {
IDLE,
PROCESSING,
};

enum class SlotCommand {
enum class SlotCommand: uint8_t {
NONE,
LOAD_PROMPT,
RELEASE,
Expand Down
2 changes: 1 addition & 1 deletion src/llama_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ constexpr const int k400BadRequest = 400;
constexpr const int k409Conflict = 409;
constexpr const int k500InternalServerError = 500;

enum class InferenceStatus { PENDING, RUNNING, EOS, FINISHED };
enum class InferenceStatus: uint8_t { PENDING, RUNNING, EOS, FINISHED };
struct inferenceState {
int task_id;
InferenceStatus inference_status = InferenceStatus::PENDING;
Expand Down
2 changes: 1 addition & 1 deletion src/llama_server_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum class StopType : uint8_t {
STOP_PARTIAL,
};

enum class ModelType { LLM = 0, EMBEDDING };
enum class ModelType: uint8_t { LLM = 0, EMBEDDING };

// TODO: reuse llama_detokenize
template <class Iter>
Expand Down

0 comments on commit adc53c9

Please sign in to comment.