optimum/executorch/modeling.py [390:417]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def __init__(self, models: Dict[str, "ExecuTorchModule"], config: "PretrainedConfig"):
        super().__init__(models=models, config=config)
        if not hasattr(self, "encoder"):
            raise AttributeError("Expected attribute 'encoder' not found in the instance.")
        if not hasattr(self, "decoder"):
            raise AttributeError("Expected attribute 'decoder' not found in the instance.")
        metadata = self.decoder.method_names()
        if "use_kv_cache" in metadata:
            self.use_kv_cache = self.decoder.run_method("use_kv_cache")[0]
        if "get_max_seq_len" in metadata:
            self.max_cache_size = self.decoder.run_method("get_max_seq_len")[0]
        if "get_max_batch_size" in metadata:
            self.max_batch_size = self.decoder.run_method("get_max_batch_size")[0]
        if "get_dtype" in metadata:
            self.dtype = self.decoder.run_method("get_dtype")[0]
        if "get_bos_id" in metadata:
            self.bos_token_id = self.decoder.run_method("get_bos_id")[0]
        if "get_eos_id" in metadata:
            self.eos_token_id = self.decoder.run_method("get_eos_id")[0]
        if "get_vocab_size" in metadata:
            self.vocab_size = self.decoder.run_method("get_vocab_size")[0]
        if "max_hidden_seq_length" in metadata:
            self.max_hidden_seq_length = self.decoder.run_method("max_hidden_seq_length")[0]
        if "decoder_start_token_id" in metadata:
            self.decoder_start_token_id = self.decoder.run_method("decoder_start_token_id")[0]

    def forward(
        self,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



optimum/executorch/modeling.py [939:966]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def __init__(self, models: Dict[str, "ExecuTorchModule"], config: "PretrainedConfig"):
        super().__init__(models=models, config=config)
        if not hasattr(self, "encoder"):
            raise AttributeError("Expected attribute 'encoder' not found in the instance.")
        if not hasattr(self, "decoder"):
            raise AttributeError("Expected attribute 'decoder' not found in the instance.")
        metadata = self.decoder.method_names()
        if "use_kv_cache" in metadata:
            self.use_kv_cache = self.decoder.run_method("use_kv_cache")[0]
        if "get_max_seq_len" in metadata:
            self.max_cache_size = self.decoder.run_method("get_max_seq_len")[0]
        if "get_max_batch_size" in metadata:
            self.max_batch_size = self.decoder.run_method("get_max_batch_size")[0]
        if "get_dtype" in metadata:
            self.dtype = self.decoder.run_method("get_dtype")[0]
        if "get_bos_id" in metadata:
            self.bos_token_id = self.decoder.run_method("get_bos_id")[0]
        if "get_eos_id" in metadata:
            self.eos_token_id = self.decoder.run_method("get_eos_id")[0]
        if "get_vocab_size" in metadata:
            self.vocab_size = self.decoder.run_method("get_vocab_size")[0]
        if "max_hidden_seq_length" in metadata:
            self.max_hidden_seq_length = self.decoder.run_method("max_hidden_seq_length")[0]
        if "decoder_start_token_id" in metadata:
            self.decoder_start_token_id = self.decoder.run_method("decoder_start_token_id")[0]

    def forward(
        self,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



