@@ -24,14 +24,17 @@ def from_config(
2424 vision_encoder_cls , vlm_base_model = vision_encoder_info
2525 return vision_encoder_cls (config , vlm_base_model )
2626
27- if "Eagle3" in model_arch :
28- # Below is a hack to detect eagle3 checkpoints.
29- # Why it exists:
30- # - Community checkpoints append "Eagle3" to architecture names ("LlamaForCausalLMEagle3").
31- # - Even NVIDIA official checkpoints (nvidia/Llama-4-Maverick-17B-128E-Eagle3) use the appended convention.
32- # - But TensorRT-LLM's MODEL_CLASS_MAPPING expects prefixed names like EAGLE3LlamaForCausalLM
33- # - Hence, LlamaForCausalLMEagle3 -> EAGLE3LlamaForCausalLM.
34- # TODO: should we provide our own checkpoints with the correct arch? It would let us avoid nasty stuff like this.
27+ # Hack to detect eagle3 checkpoints.
28+ # Why it exists:
29+ # - Eagle3 checkpoints have draft_vocab_size in config.json (even if None)
30+ # - Some community checkpoints append "Eagle3" to architecture names ("LlamaForCausalLMEagle3")
31+ # - Some checkpoints don't include "Eagle3" in arch name at all ("LlamaForCausalLM")
32+ # - TensorRT-LLM's MODEL_CLASS_MAPPING expects prefixed names like EAGLE3LlamaForCausalLM
33+ # - Hence: LlamaForCausalLMEagle3 -> EAGLE3LlamaForCausalLM
34+ # LlamaForCausalLM (with draft_vocab_size) -> EAGLE3LlamaForCausalLM
35+ # TODO: should we provide our own checkpoints with the correct arch? It would let us avoid nasty stuff like this.
36+ if hasattr (config .pretrained_config , "draft_vocab_size" ):
37+ # It's an Eagle3 checkpoint - strip "Eagle3" suffix if present, then add prefix
3538 model_arch = model_arch .replace ("Eagle3" , "" )
3639 model_arch = "EAGLE3" + model_arch
3740 if model_arch in (
0 commit comments