in src/exporters/coreml/config.py [0:0]
def num_attention_heads(self) -> int:
"""
The number of attention heads retrieved from the model config. Override this for model configs where
the number of attention heads attribute is not called `num_attention_heads`.
"""
if self.seq2seq == "encoder" and hasattr(self._config, "encoder_attention_heads"):
return self._config.encoder_attention_heads
if self.seq2seq == "decoder" and hasattr(self._config, "decoder_attention_heads"):
return self._config.decoder_attention_heads
if not hasattr(self._config, "num_attention_heads"):
raise AttributeError(
"could not find the number of attention heads attribute in the model configuration, override the"
" num_attention_heads property of the model CoreMLConfig to solve this"
)
return self._config.num_attention_heads