Skip to content

Commit

Permalink
Clang-tidy fixes
Browse files Browse the repository at this point in the history
1. Add missing override.
2. Add some include headers to some source files.
  • Loading branch information
snnn authored Jan 22, 2024
2 parents 00df72d + bbd2370 commit 35db95d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct Root_Element : JSON::Element {
config_.early_stopping = value;
}

Element& OnObject(std::string_view name) {
Element& OnObject(std::string_view name) override {
if (name == "model")
return model_element_;
return Element::OnObject(name);
Expand Down Expand Up @@ -159,4 +159,4 @@ Config::Config(const std::filesystem::path& path) : config_path{path} {
ParseConfig(path / "config.json", *this);
}

} // namespace Generators
} // namespace Generators
13 changes: 9 additions & 4 deletions src/ort_genai_c.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "ort_genai_c.h"
#include <memory>
#include <onnxruntime_c_api.h>
#include <exception>
#include <cstdint>
#include <cstddef>
#include "generators.h"
#include "search.h"
#include "models/model.h"

namespace Generators {

std::unique_ptr<OrtEnv> g_ort_env;

OrtEnv& GetOrtEnv() {
if (!g_ort_env)
if (!g_ort_env) {
g_ort_env = OrtEnv::Create();
}
return *g_ort_env;
}

}
} // namespace Generators

extern "C" {

struct OgaResult {
OgaResult(const char *what){}
explicit OgaResult(const char *what){}
// TODO: implement this constructor !!!!
};

Expand Down
3 changes: 2 additions & 1 deletion src/sampling_cpu.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

#if 0
#include "generators.h"
#include <algorithm>
#include <random>

#if 0
int top_k_sampling(std::span<float> scores, float temperature, int k) {
std::vector<std::pair<float, int>> top_k;
std::default_random_engine generator;
Expand Down

0 comments on commit 35db95d

Please sign in to comment.