Internal change

PiperOrigin-RevId: 799509375
This commit is contained in:
Jan Wassenberg 2025-08-26 04:43:26 -07:00 committed by Copybara-Service
parent d3a5ddf657
commit 9bf0fe4e37
2 changed files with 12 additions and 10 deletions

View File

@ -710,8 +710,10 @@ bool ModelConfig::TestEqual(const ModelConfig& other, bool print) const {
ModelConfig a = *this; ModelConfig a = *this;
ModelConfig b = other; ModelConfig b = other;
// Called by `OverwriteWithCanonical`, so ignore the fields it will set. // Called by `OverwriteWithCanonical`, so ignore the fields it will set.
a.display_name = b.display_name; // Order matters: overwrite `b` with `a` because that is the known-good config
a.model = b.model; // when called by `OverwriteWithCanonical`.
b.display_name = a.display_name;
b.model = a.model;
// The following are not yet set by config_converter.py, so we here ignore // The following are not yet set by config_converter.py, so we here ignore
// them for purposes of comparison, and there overwrite the converter's config // them for purposes of comparison, and there overwrite the converter's config
@ -719,12 +721,12 @@ bool ModelConfig::TestEqual(const ModelConfig& other, bool print) const {
// these fields will be set. // these fields will be set.
// `vit_config` is also not yet set, but we must not ignore it because // `vit_config` is also not yet set, but we must not ignore it because
// otherwise PaliGemma models will be indistinguishable for `configs_test`. // otherwise PaliGemma models will be indistinguishable for `configs_test`.
a.pool_dim = b.pool_dim; // ViT b.pool_dim = a.pool_dim; // ViT
a.eos_id = b.eos_id; b.eos_id = a.eos_id;
a.secondary_eos_id = b.secondary_eos_id; b.secondary_eos_id = a.secondary_eos_id;
a.scale_base_names = b.scale_base_names; b.scale_base_names = a.scale_base_names;
for (size_t i = 0; i < a.layer_configs.size(); ++i) { for (size_t i = 0; i < b.layer_configs.size(); ++i) {
a.layer_configs[i].optimized_gating = b.layer_configs[i].optimized_gating; b.layer_configs[i].optimized_gating = a.layer_configs[i].optimized_gating;
} }
return AllEqual(a, b, print); return AllEqual(a, b, print);

View File

@ -26,8 +26,8 @@
#include <vector> #include <vector>
#include "compression/types.h" // Type #include "compression/types.h" // Type
#include "io/fields.h" // IFieldsVisitor #include "io/fields.h" // IFieldsVisitor
#include "io/io.h" // Path #include "io/io.h" // Path
#include "util/basics.h" #include "util/basics.h"
namespace gcpp { namespace gcpp {