From 606427022cdd96b77f226530c27f42705c6b4005 Mon Sep 17 00:00:00 2001 From: Daniel Keysers Date: Thu, 26 Sep 2024 01:54:06 -0700 Subject: [PATCH] Fix compiler errors when trying to generate (unused) code for the ConfigNoVit struct. PiperOrigin-RevId: 679049377 --- gemma/configs.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gemma/configs.h b/gemma/configs.h index d034da2..c78ab87 100644 --- a/gemma/configs.h +++ b/gemma/configs.h @@ -134,16 +134,24 @@ struct CachePosSize { struct ConfigNoVit { struct VitConfig { + // Some of these are needed to make the compiler happy when trying to + // generate code that will actually never be used. + using Weight = float; static constexpr int kLayers = 0; static constexpr std::array kLayerConfig = FixedLayerConfig<0>(LayerAttentionType::kVit); static constexpr int kModelDim = 0; static constexpr int kFFHiddenDim = 0; - static constexpr int kHeads = 0; + static constexpr int kHeads = 1; // Avoid division by 0 in griffin gate_w. static constexpr int kKVHeads = 0; static constexpr int kQKVDim = 0; static constexpr int kSeqLen = 0; static constexpr ResidualType kResidual = ResidualType::Add; + static constexpr int kGriffinLayers = 0; + static constexpr int kConv1dWidth = 0; + static constexpr bool kFFBiases = false; + static constexpr bool kSoftmaxAttnOutputBiases = false; + static constexpr PostNormType kPostNorm = PostNormType::None; }; };