MCPcopy Create free account
hub / github.com/pytorch/executorch / _get_default_pipeline

Method _get_default_pipeline

export/export.py:264–294  ·  view source on GitHub ↗

Get default pipeline stages based on input model type. Returns: List of stages appropriate for the input model type

(self)

Source from the content-addressed store, hash-verified

262 raise TypeError(f"Unsupported model type: {type(model)}")
263
264 def _get_default_pipeline(self) -> List[StageType]:
265 """
266 Get default pipeline stages based on input model type.
267
268 Returns:
269 List of stages appropriate for the input model type
270 """
271 stages = []
272
273 # Add quantization stages only for eager nn.Module
274 if self._input_model_type == "nn.Module":
275 stages.extend(
276 [
277 StageType.SOURCE_TRANSFORM, # Optional stage, returns original model if quant recipe is invalid
278 StageType.QUANTIZE, # Optional stage, returns original model if quant recipe is invalid
279 ]
280 )
281
282 # Add torch export stage if not already exported
283 if self._input_model_type != "ExportedProgram":
284 stages.append(StageType.TORCH_EXPORT)
285
286 # Always include edge and executorch stages
287 stages.extend(
288 [
289 StageType.TO_EDGE_TRANSFORM_AND_LOWER,
290 StageType.TO_EXECUTORCH,
291 ]
292 )
293
294 return stages
295
296 def _build_stages(self, stages: List[StageType]) -> Dict[StageType, Stage]:
297 """Build the stage registry from the given stages."""

Calls 1

appendMethod · 0.45