Skip to content

Commit 587e80f

Browse files
The gemma_cpp Authorsdan-zheng
The gemma_cpp Authors
authored andcommitted
Code update
PiperOrigin-RevId: 609394329
1 parent fb6f266 commit 587e80f

File tree

5 files changed

+188
-192
lines changed

5 files changed

+188
-192
lines changed

compression/stats.cc

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#include "hwy/base.h" // HWY_ASSERT
2525

26+
namespace gcpp {
27+
2628
void Stats::Assimilate(const Stats& other) {
2729
const int64_t total_n = n_ + other.n_;
2830
if (total_n == 0) return; // Nothing to do; prevents div by zero.
@@ -115,3 +117,5 @@ std::string Stats::ToString(int exclude) const {
115117
HWY_ASSERT(pos < sizeof(buf));
116118
return buf;
117119
}
120+
121+
} // namespace gcpp

compression/stats.h

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
#include "hwy/base.h" // HWY_ASSERT
2727

28+
namespace gcpp {
29+
2830
// Thread-compatible.
2931
template <size_t N>
3032
class Bins {
@@ -187,4 +189,6 @@ class Stats {
187189
double m4_;
188190
};
189191

192+
} // namespace gcpp
193+
190194
#endif // THIRD_PARTY_GEMMA_CPP_COMPRESSION_STATS_H_

configs.h

+19-23
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,34 @@
1818
#ifndef THIRD_PARTY_GEMMA_CPP_CONFIGS_H_
1919
#define THIRD_PARTY_GEMMA_CPP_CONFIGS_H_
2020

21-
#include <cstddef>
21+
#include <stddef.h>
2222

2323
namespace gcpp {
2424

2525
static constexpr size_t kSeqLen = 7168;
2626

2727
struct ConfigGemma7B {
28-
// NOLINTBEGIN(google3-readability-class-member-naming)
29-
static constexpr int seq_len = kSeqLen;
30-
static constexpr int vocab_size = 256128;
31-
static constexpr int n_layers = 28;
32-
static constexpr int dim_model = 3072;
33-
static constexpr int dim_ffw_hidden = 16 * 3072 / 2; // = 24576
34-
static constexpr int n_heads = 16;
35-
static constexpr int n_kv_heads = 16; // standard MHA, no GQA or MQA
36-
static constexpr int dim_qkv = 256; // query size == key size == value size
37-
static constexpr int top_k = 1;
38-
// NOLINTEND(google3-readability-class-member-naming)
28+
static constexpr int kSeqLen = gcpp::kSeqLen;
29+
static constexpr int kVocabSize = 256128;
30+
static constexpr int kLayers = 28;
31+
static constexpr int kModelDim = 3072;
32+
static constexpr int kFFHiddenDim = 16 * 3072 / 2; // = 24576
33+
static constexpr int kHeads = 16;
34+
static constexpr int kKVHeads = 16; // standard MHA, no GQA or MQA
35+
static constexpr int kQKVDim = 256; // query size == key size == value size
36+
static constexpr int kTopK = 1;
3937
};
4038

4139
struct ConfigGemma2B {
42-
// NOLINTBEGIN(google3-readability-class-member-naming)
43-
static constexpr int seq_len = kSeqLen;
44-
static constexpr int vocab_size = 256128;
45-
static constexpr int n_layers = 18;
46-
static constexpr int dim_model = 2048;
47-
static constexpr int dim_ffw_hidden = 16 * 2048 / 2; // = 16384
48-
static constexpr int n_heads = 8;
49-
static constexpr int n_kv_heads = 8; // TODO(austinvhuang): add MQA support
50-
static constexpr int dim_qkv = 256; // query size == key size == value size
51-
static constexpr int top_k = 1;
52-
// NOLINTEND(google3-readability-class-member-naming)
40+
static constexpr int kSeqLen = gcpp::kSeqLen;
41+
static constexpr int kVocabSize = 256128;
42+
static constexpr int kLayers = 18;
43+
static constexpr int kModelDim = 2048;
44+
static constexpr int kFFHiddenDim = 16 * 2048 / 2; // = 16384
45+
static constexpr int kHeads = 8;
46+
static constexpr int kKVHeads = 8; // TODO(austinvhuang): add MQA support
47+
static constexpr int kQKVDim = 256; // query size == key size == value size
48+
static constexpr int kTopK = 1;
5349
};
5450

5551
} // namespace gcpp

0 commit comments

Comments
 (0)