@@ -172,6 +172,66 @@ def __init__(self) -> None:
172172 super ().__init__ (names = ("qwen" , "qwen2" , "qwen3" , "qwen2moe" , "qwen3moe" ))
173173
174174
175+ @register_profile
176+ class SeedProfile (StandardDecoderProfile ):
177+ """
178+ Profile for Seed OSS models (Seed-OSS-36B, etc.).
179+ Seed models are Llama-based but may use different metadata keys.
180+ Seed-OSS-36B has 64 transformer layers (not 32).
181+ """
182+ def __init__ (self ) -> None :
183+ super ().__init__ (names = ("seed" , "seed-oss" , "seedoss" ))
184+
185+ def _calculate_layers (
186+ self , metadata : Dict [str , Any ], base_block_count : int
187+ ) -> LayerConfig :
188+ # Seed models might use 'llama' prefix or 'seed' prefix
189+ # Check multiple candidate keys, prioritizing seed-specific keys
190+ candidate_keys = [
191+ "seed.block_count" ,
192+ "seed.n_layer" ,
193+ "seed.n_layers" ,
194+ "llama.block_count" ,
195+ "llama.n_layer" ,
196+ "llama.n_layers" ,
197+ "general.block_count" ,
198+ "general.n_layer" ,
199+ ]
200+
201+ metadata_block_count = _get_first_valid_int (
202+ metadata , candidate_keys , default = None
203+ )
204+
205+ # Use the maximum of metadata value or tensor-based count
206+ # This is important because Seed models might have incorrect metadata
207+ # but correct tensor counts
208+ if metadata_block_count is not None :
209+ block_count = max (metadata_block_count , base_block_count ) if base_block_count > 0 else metadata_block_count
210+ if metadata_block_count < base_block_count :
211+ logger .info (
212+ f"Seed profile: metadata shows { metadata_block_count } layers but tensor count suggests { base_block_count } , "
213+ f"using tensor count ({ base_block_count } )"
214+ )
215+ else :
216+ block_count = base_block_count if base_block_count > 0 else 0
217+
218+ # Special handling: If we detect around 32 layers but the model size suggests 64,
219+ # it might be a Seed model with incorrect metadata
220+ if block_count > 0 and block_count < 40 :
221+ # Check if tensor count suggests more (Seed-OSS-36B should have ~64)
222+ if base_block_count > block_count * 1.5 :
223+ logger .warning (
224+ f"Seed profile: Detected potential mismatch - metadata={ block_count } , "
225+ f"tensor_count={ base_block_count } . Using tensor_count."
226+ )
227+ block_count = base_block_count
228+
229+ # Standard decoder: blocks + output head
230+ effective = (block_count + 1 ) if block_count > 0 else 0
231+
232+ return LayerConfig (block_count = block_count , effective_layer_count = effective )
233+
234+
175235@register_profile
176236class LlamaLikeProfile (StandardDecoderProfile ):
177237 """LLaMA, Mistral, Mixtral, Gemma, Phi, etc."""
0 commit comments