{"record":{"id":"383e15b2a5305856","repo":"sgl-project/sglang","slug":"projection-cls-projection-cls-not-implemented","errorCode":null,"errorMessage":"projection_cls = {projection_cls}, not implemented","messagePattern":"projection_cls = (.+?), not implemented","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/phi4mm_audio.py","lineNumber":1173,"sourceCode":"            depth = 2\n            self.linear_downsample_rate = (\n                1 if (self.qformer or self.conv_ds) else self.downsample_rate\n            )\n            layers = [\n                nn.Linear(audio_dim_out * self.linear_downsample_rate, dim_projection)\n            ]\n            for _ in range(1, depth):\n                layers.extend([nn.GELU(), nn.Linear(dim_projection, dim_projection)])\n            self.audio_projection = nn.Sequential(*layers)\n            # NOTE vision-speech tasks use a separate projection layer\n            layers = [\n                nn.Linear(audio_dim_out * self.linear_downsample_rate, dim_projection)\n            ]\n            for _ in range(1, depth):\n                layers.extend([nn.GELU(), nn.Linear(dim_projection, dim_projection)])\n            self.audio_projection_for_vision = nn.Sequential(*layers)\n        else:\n            raise NotImplementedError(\n                f\"projection_cls = {projection_cls}, not implemented\"\n            )\n\n        # TODO: audio sequence compression - Qformer\n        self.vocab_size = config.vocab_size\n        self.input_embeds = None\n        self.audio_embed_sizes = None\n\n    def set_audio_embeds(self, input_embeds: torch.FloatTensor) -> None:\n        self.input_embeds = input_embeds\n\n    def set_audio_embed_sizes(self, audio_embed_sizes: torch.LongTensor) -> None:\n        self.audio_embed_sizes = audio_embed_sizes\n\n    def get_audio_features(\n        self,\n        input_embeds: torch.FloatTensor,\n        audio_attention_mask: torch.Tensor = None,","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/phi4mm_audio.py#L1155-L1191","documentation":"The audio-to-LLM projection module in Phi-4-MM audio only implements specific projection classes (a stack of Linear+GELU layers, and the audio_projection_for_vision variant). If projection_cls in the config does not match one of the implemented branches, __init__ raises NotImplementedError naming the offending class.","triggerScenarios":"Instantiating the Phi4MMAudioModel / projection with a config whose projection_cls is anything other than the supported values (e.g. 'qformer' or a custom class name), since the Qformer path is an explicit TODO.","commonSituations":"Loading a fine-tuned or newer Phi-4-MM checkpoint that swapped the linear projection for a Q-Former-style compressor; hand-editing model configs.","solutions":["Set projection_cls back to the supported value in the model/config","Use the original phi-4-multimodal-instruct checkpoint whose projection matches the implementation","Implement the missing projection class in phi4mm_audio.py following the nn.Sequential pattern of the existing branches"],"exampleFix":"// before\n\"projection_cls\": \"qformer\"  # raises NotImplementedError\n// after\n\"projection_cls\": \"linear\"   # supported stack of Linear/GELU layers","handlingStrategy":"validation","validationCode":"SUPPORTED_PROJECTIONS = {\"linear\", \"mlp\"}  # values handled by phi4mm_audio branches\nassert config.projection_cls in SUPPORTED_PROJECTIONS, f\"projection_cls {config.projection_cls} unsupported\"","typeGuard":"def is_supported_projection(cls_name: str) -> bool:\n    return cls_name in {\"linear\", \"mlp\"}","tryCatchPattern":null,"preventionTips":["Whitelist supported projection_cls values before constructing the audio model","Never hand-edit projection_cls in checkpoint configs","Watch the explicit TODO: QFormer projection is intentionally unimplemented"],"tags":["phi4","multimodal","projection","not-implemented","config-validation"],"backgroundTag":"unsupported-model-configuration","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}