Skip to content

Commit 7122afe

Browse files
jan-wassenbergcopybara-github
authored andcommitted
Add note on weight update and improve error message
PiperOrigin-RevId: 621849989
1 parent 08948f1 commit 7122afe

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ For additional information about Gemma, see
88
specific artifacts, are [available on
99
kaggle](https://www.kaggle.com/models/google/gemma).
1010

11+
NOTE: 2024-04-04: if using 2B models, please re-download weights from Kaggle and
12+
ensure you have the latest version (-mqa or version 3). We are changing the code
13+
to match the new weights. If you wish to use old weights, change `ConfigGemma2B`
14+
in `configs.h` back to `kVocabSize = 256128` and `kKVHeads = 8`.
15+
1116
## Who is this project for?
1217

1318
Modern LLM inference engines are sophisticated systems, often with bespoke

compression/blob_store.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,13 @@ BlobError BlobReader::Enqueue(hwy::uint128_t key, void* data, size_t size) {
378378
uint64_t offset;
379379
size_t actual_size;
380380
if (!blob_store_->FindKey(key, offset, actual_size)) return __LINE__;
381-
if (actual_size != size) return __LINE__;
381+
if (actual_size != size) {
382+
fprintf(stderr,
383+
"Mismatch between expected %d and actual %d KiB size. Please see "
384+
"README.md on how to update the weights.\n",
385+
static_cast<int>(size >> 10), static_cast<int>(actual_size >> 10));
386+
return __LINE__;
387+
}
382388

383389
EnqueueChunkRequests(offset, actual_size, reinterpret_cast<uint8_t*>(data),
384390
requests_);

gemma.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ hwy::AlignedUniquePtr<Weights<TConfig>> LoadWeights(const Path& checkpoint) {
109109
weights->layers =
110110
hwy::MakeUniqueAlignedArray<Layer<TConfig>>(TConfig::kLayers);
111111

112+
if (checkpoint.path.empty()) {
113+
HWY_ABORT(
114+
"Loading --compressed_weights failed; we require a --weights argument. "
115+
"Please see issue #11 on how to create this file.\n");
116+
}
117+
112118
FILE* fptr;
113119
fptr = fopen(checkpoint.path.c_str(), "rb");
114120
if (fptr == nullptr) {

0 commit comments

Comments
 (0)