Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoangthuan99 committed Aug 28, 2024
1 parent bd71837 commit 5883d98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
32 changes: 19 additions & 13 deletions engine/commands/model_get_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "utils/cortex_utils.h"

namespace commands {
ModelGetCmd::ModelGetCmd(std::string modelHandle)
: modelHandle_(std::move(modelHandle)) {}
ModelGetCmd::ModelGetCmd(std::string model_handle)
: model_handle_(std::move(model_handle)) {}

void ModelGetCmd::Exec() {
if (std::filesystem::exists(cortex_utils::models_folder) &&
Expand All @@ -17,7 +17,8 @@ void ModelGetCmd::Exec() {
// Iterate through directory
for (const auto& entry :
std::filesystem::directory_iterator(cortex_utils::models_folder)) {
if (entry.is_regular_file() && entry.path().stem() == modelHandle_ && entry.path().extension() == ".yaml") {
if (entry.is_regular_file() && entry.path().stem() == model_handle_ &&
entry.path().extension() == ".yaml") {
try {
config::YamlHandler handler;
handler.ModelConfigFromFile(entry.path().string());
Expand Down Expand Up @@ -59,7 +60,8 @@ void ModelGetCmd::Exec() {
if (!std::isnan(static_cast<double>(model_config.max_tokens)))
std::cout << "max_tokens: " << model_config.max_tokens << "\n";
if (!std::isnan(static_cast<double>(model_config.stream)))
std::cout << "stream: " << std::boolalpha << model_config.stream << "\n";
std::cout << "stream: " << std::boolalpha << model_config.stream
<< "\n";
if (!std::isnan(static_cast<double>(model_config.ngl)))
std::cout << "ngl: " << model_config.ngl << "\n";
if (!std::isnan(static_cast<double>(model_config.ctx_len)))
Expand All @@ -69,20 +71,23 @@ void ModelGetCmd::Exec() {
if (!model_config.engine.empty())
std::cout << "engine: " << model_config.engine << "\n";
if (!model_config.prompt_template.empty())
std::cout << "prompt_template: " << model_config.prompt_template << "\n";
std::cout << "prompt_template: " << model_config.prompt_template
<< "\n";
if (!model_config.system_template.empty())
std::cout << "system_template: " << model_config.system_template << "\n";
std::cout << "system_template: " << model_config.system_template
<< "\n";
if (!model_config.user_template.empty())
std::cout << "user_template: " << model_config.user_template << "\n";
std::cout << "user_template: " << model_config.user_template
<< "\n";
if (!model_config.ai_template.empty())
std::cout << "ai_template: " << model_config.ai_template << "\n";
if (!model_config.os.empty())
std::cout << "os: " << model_config.os << "\n";
if (!model_config.gpu_arch.empty())
std::cout << "gpu_arch: " << model_config.gpu_arch << "\n";
if (!model_config.quantization_method.empty())
std::cout << "quantization_method: " << model_config.quantization_method
<< "\n";
std::cout << "quantization_method: "
<< model_config.quantization_method << "\n";
if (!model_config.precision.empty())
std::cout << "precision: " << model_config.precision << "\n";

Expand All @@ -91,11 +96,12 @@ void ModelGetCmd::Exec() {

// Print non-null strings
if (!model_config.trtllm_version.empty())
std::cout << "trtllm_version: " << model_config.trtllm_version << "\n";
if (!std::isnan(static_cast<double>(model_config.text_model)))
std::cout << "text_model: " << std::boolalpha << model_config.text_model
std::cout << "trtllm_version: " << model_config.trtllm_version
<< "\n";

if (!std::isnan(static_cast<double>(model_config.text_model)))
std::cout << "text_model: " << std::boolalpha
<< model_config.text_model << "\n";

// Print non-empty vectors
if (!model_config.files.empty()) {
std::cout << "files: [";
Expand Down
6 changes: 3 additions & 3 deletions engine/commands/model_get_cmd.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#pragma once

#include <cmath> // For std::isnan
#include <string>
#include <cmath> // For std::isnan
namespace commands {

class ModelGetCmd {
public:
ModelGetCmd(std::string modelHandle);
ModelGetCmd(std::string model_handle);
void Exec();

private:
std::string modelHandle_;
std::string model_handle_;
};
} // namespace commands

0 comments on commit 5883d98

Please sign in to comment.