rename normalization layers

This commit is contained in:
wheelspawn 2024-06-18 10:04:58 -05:00
parent 7a5d932eaf
commit da43a545ef

View file

@ -2197,6 +2197,9 @@ class BertModel(Model):
# we are only using BERT for embeddings so we don't need the pooling layer # we are only using BERT for embeddings so we don't need the pooling layer
if name in ("embeddings.position_ids", "pooler.dense.weight", "pooler.dense.bias") or "cls." in name: if name in ("embeddings.position_ids", "pooler.dense.weight", "pooler.dense.bias") or "cls." in name:
return [] # we don't need these return [] # we don't need these
name = name.replace("gamma", "weight")
name = name.replace("beta", "bias")
try_suffixes = (".weight", ".bias", ".beta", ".gamma") try_suffixes = (".weight", ".bias", ".beta", ".gamma")
return [(self.map_tensor_name(name, try_suffixes), data_torch)] return [(self.map_tensor_name(name, try_suffixes), data_torch)]