| 821 | |
| 822 | |
| 823 | def resolve_model_classes( |
| 824 | config_filepath, bypass_tokenizer=False, response_handler=None |
| 825 | ): |
| 826 | config_file = json.load(open(config_filepath, "r")) |
| 827 | weight_dir = get_dirname(config_filepath) |
| 828 | |
| 829 | if config_file.get("llm", None) is None: |
| 830 | if config_file["model_type"] == "llama": |
| 831 | from models.llm_models.configuration_llama import ( |
| 832 | LlamaConfig as config_class, |
| 833 | ) |
| 834 | from models.llm_models.modeling_llama import LlamaModelChunk as chunk_class |
| 835 | elif config_file["model_type"] == "qwen2": |
| 836 | from models.llm_models.configuration_qwen import QwenConfig as config_class |
| 837 | from models.llm_models.modeling_qwen import Qwen2ModelChunk as chunk_class |
| 838 | elif config_file["model_type"] == "qwen3": |
| 839 | from models.llm_models.configuration_qwen import QwenConfig as config_class |
| 840 | from models.llm_models.modeling_qwen import Qwen3ModelChunk as chunk_class |
| 841 | elif config_file["model_type"] == "phi3": |
| 842 | from models.llm_models.configuration_phi import PhiConfig as config_class |
| 843 | from models.llm_models.modeling_phi import Phi3ModelChunk as chunk_class |
| 844 | elif config_file["model_type"] == "phi4": |
| 845 | from models.llm_models.configuration_phi import PhiConfig as config_class |
| 846 | from models.llm_models.modeling_phi import Phi4ModelChunk as chunk_class |
| 847 | elif config_file["model_type"] == "gemma2": |
| 848 | from models.llm_models.configuration_gemma import ( |
| 849 | GemmaConfig as config_class, |
| 850 | ) |
| 851 | from models.llm_models.modeling_gemma import Gemma2ModelChunk as chunk_class |
| 852 | elif config_file["model_type"] == "gemma3": |
| 853 | from models.llm_models.configuration_gemma import ( |
| 854 | GemmaConfig as config_class, |
| 855 | ) |
| 856 | from models.llm_models.modeling_gemma import Gemma3ModelChunk as chunk_class |
| 857 | else: |
| 858 | if config_file["llm"]["model_type"] == "whisper_decoder": |
| 859 | from models.llm_models.configuration_whisper import ( |
| 860 | WhisperConfig as config_class, |
| 861 | ) |
| 862 | from models.llm_models.modeling_whisper import ( |
| 863 | WhisperDecoderModelChunk as decoder_class, |
| 864 | WhisperEncoderModel as encoder_class, |
| 865 | ) |
| 866 | |
| 867 | chunk_class = [encoder_class, decoder_class] |
| 868 | config = config_class(**config_file, response_handler=response_handler) |
| 869 | if bypass_tokenizer: |
| 870 | return config, weight_dir, chunk_class |
| 871 | else: |
| 872 | if config.tokenizer == "default": |
| 873 | if config_file.get("llm", None) is None: |
| 874 | if config_file["model_type"] in ["llama", "phi3"]: |
| 875 | from aot_utils.llm_utils.tokenizers_.tokenization_llama import ( |
| 876 | LlamaTokenizer as tokenizer_class, |
| 877 | ) |
| 878 | elif config_file["model_type"] in ["qwen3", "qwen2"]: |
| 879 | from aot_utils.llm_utils.tokenizers_.tokenization_qwen2_fast import ( |
| 880 | Qwen2TokenizerFast as tokenizer_class, |