From 0e2cab518721d2e3bf160b6e808c8943496a73c0 Mon Sep 17 00:00:00 2001 From: Jan Wassenberg Date: Thu, 5 Jun 2025 09:09:26 -0700 Subject: [PATCH] Avoid warning about inability to map, unless explicitly requested PiperOrigin-RevId: 767633815 --- gemma/weights.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gemma/weights.cc b/gemma/weights.cc index c2e47f2..51cce2d 100644 --- a/gemma/weights.cc +++ b/gemma/weights.cc @@ -267,12 +267,12 @@ static Mode ChooseMode(uint64_t file_bytes, const LoaderArgs& loader, // Disable mapping if not padded to the base page size. const Allocator& allocator = ThreadingContext::Get().allocator; if (file_bytes % allocator.BasePageBytes() != 0) { - if (map != Tristate::kFalse) { // Do not complain if anyway disabled. + if (map == Tristate::kTrue) { // Only complain if explicitly requested. HWY_WARN("Unable to map non-padded file (%zu, %zu), reading instead.", static_cast(file_bytes >> 10), allocator.BasePageBytes()); - map = Tristate::kFalse; } + map = Tristate::kFalse; } // Check for user override: