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