Add CPU output, error if not C++17, simplify tokenizer ctor

PiperOrigin-RevId: 641850879
This commit is contained in:
Jan Wassenberg 2024-06-10 04:00:21 -07:00 committed by Copybara-Service
parent 020db5a67d
commit 36e6915e18
3 changed files with 12 additions and 7 deletions

View File

@ -19,7 +19,6 @@
#include <random> #include <random>
#include "gemma/common.h" #include "gemma/common.h"
#include "gemma/configs.h"
#include "gemma/weights.h" #include "gemma/weights.h"
#include "hwy/contrib/thread_pool/thread_pool.h" #include "hwy/contrib/thread_pool/thread_pool.h"

View File

@ -194,10 +194,8 @@ GemmaTokenizer::GemmaTokenizer(const Path& tokenizer_path) {
impl_ = std::make_unique<Impl>(tokenizer_path); impl_ = std::make_unique<Impl>(tokenizer_path);
} }
GemmaTokenizer::GemmaTokenizer() { // Default suffices, but they must be defined after GemmaTokenizer::Impl.
impl_ = std::make_unique<Impl>(); GemmaTokenizer::GemmaTokenizer() = default;
}
GemmaTokenizer::~GemmaTokenizer() = default; GemmaTokenizer::~GemmaTokenizer() = default;
GemmaTokenizer::GemmaTokenizer(GemmaTokenizer&& other) = default; GemmaTokenizer::GemmaTokenizer(GemmaTokenizer&& other) = default;
GemmaTokenizer& GemmaTokenizer::operator=(GemmaTokenizer&& other) = default; GemmaTokenizer& GemmaTokenizer::operator=(GemmaTokenizer&& other) = default;

View File

@ -35,10 +35,14 @@
#include "hwy/highway.h" #include "hwy/highway.h"
#include "hwy/per_target.h" #include "hwy/per_target.h"
#include "hwy/profiler.h" #include "hwy/profiler.h"
#include "hwy/timer.h"
#if (!defined(HWY_VERSION_LT) || HWY_VERSION_LT(1, 2)) && !HWY_IDE #if (!defined(HWY_VERSION_LT) || HWY_VERSION_LT(1, 2)) && !HWY_IDE
#error "Please update to version 1.2 of github.com/google/highway." #error "Please update to version 1.2 of github.com/google/highway."
#endif #endif
#if HWY_CXX_LANG < 201703L
#error "Gemma.cpp requires C++17, please pass -std=c++17."
#endif
static constexpr bool kVerboseLogTokens = false; static constexpr bool kVerboseLogTokens = false;
@ -68,8 +72,12 @@ void ShowConfig(LoaderArgs& loader, InferenceArgs& inference, AppArgs& app) {
<< std::thread::hardware_concurrency() << "\n" << std::thread::hardware_concurrency() << "\n"
<< "Instruction set : " << "Instruction set : "
<< hwy::TargetName(hwy::DispatchedTarget()) << " (" << hwy::TargetName(hwy::DispatchedTarget()) << " ("
<< hwy::VectorBytes() * 8 << " bits)" << "\n" << hwy::VectorBytes() * 8 << " bits)" << "\n";
<< "Compiled config : " << CompiledConfig() << "\n" char cpu100[100];
if (hwy::platform::GetCpuString(cpu100)) {
std::cout << "CPU : " << cpu100 << "\n";
}
std::cout << "Compiled config : " << CompiledConfig() << "\n"
<< "Weight Type : " << "Weight Type : "
<< gcpp::StringFromType(loader.WeightType()) << "\n" << gcpp::StringFromType(loader.WeightType()) << "\n"
<< "EmbedderInput Type : " << "EmbedderInput Type : "