Inline the ctor of `GemmaChatTemplate`

This commit is contained in:
RangerUFO 2025-03-27 14:01:56 +08:00
parent d1615b56b2
commit c39295f497
2 changed files with 3 additions and 5 deletions

View File

@ -114,10 +114,6 @@ bool GemmaTokenizer::Decode(const std::vector<int>& ids,
return impl_->Decode(ids, detokenized); return impl_->Decode(ids, detokenized);
} }
GemmaChatTemplate::GemmaChatTemplate(const GemmaTokenizer& tokenizer) {
Init(tokenizer);
}
void GemmaChatTemplate::Init(const GemmaTokenizer& tokenizer) { void GemmaChatTemplate::Init(const GemmaTokenizer& tokenizer) {
sot_user_.reserve(3); sot_user_.reserve(3);
HWY_ASSERT(tokenizer.Encode("<start_of_turn>user\n", &sot_user_)); HWY_ASSERT(tokenizer.Encode("<start_of_turn>user\n", &sot_user_));

View File

@ -57,7 +57,9 @@ class GemmaTokenizer {
class GemmaChatTemplate { class GemmaChatTemplate {
public: public:
GemmaChatTemplate() = default; GemmaChatTemplate() = default;
explicit GemmaChatTemplate(const GemmaTokenizer& tokenizer); explicit GemmaChatTemplate(const GemmaTokenizer& tokenizer) {
Init(tokenizer);
}
void Init(const GemmaTokenizer& tokenizer); void Init(const GemmaTokenizer& tokenizer);
std::vector<int> Apply(size_t pos, const std::vector<int>& ids) const; std::vector<int> Apply(size_t pos, const std::vector<int>& ids) const;