starling.set_compilation_options

set_compilation_options(enabled=None, **torch_compile_kwargs)[source]

Configure model compilation settings programmatically with full support for PyTorch compile parameters.

Parameters:
  • enabled (bool or None) – Whether to enable model compilation. If None, keeps current setting.

  • **torch_compile_kwargs (keyword arguments) –

    Any valid arguments for torch.compile, such as:

    • mode (str): Compilation mode (“default”, “reduce-overhead”, “max-autotune”)

    • backend (str): Compilation backend (“inductor”, “eager”, “aot_eager”, etc.)

    • fullgraph (bool): Whether to compile the full graph

    • dynamic (bool): Whether to handle dynamic shapes

    • disable (bool): Temporarily disable compilation

    • options (dict): Backend-specific options like {“triton.cudagraphs”: True}

Examples

>>> import starling
>>> # Basic usage
>>> starling.set_compilation_options(enabled=True, mode="reduce-overhead")
>>>
>>> # Advanced usage with torch.compile parameters
>>> starling.set_compilation_options(
...     enabled=True,
...     backend="inductor",
...     fullgraph=False,
...     dynamic=True,
...     options={"triton.cudagraphs": True}
... )
>>> results = starling.generate(...)  # Uses compiled models with custom settings
Returns:

Current compilation settings

Return type:

dict