Torch

Torch Compile

From the OpenAI challenge, they do

compiled_model = torch.compile(base_model, dynamic=False, fullgraph=True)

What do these flags mean?

  • dynamic (bool or None) – Use dynamic shape tracing. When this is True, we will up-front attempt to generate a kernel that is as dynamic as possible to avoid recompilations when sizes change
  • fullgraph (bool) – If False (default), torch.compile attempts to discover compilable regions in the function that it will optimize. If True, then we require that the entire function be capturable into a single graph. If this is not possible (that is, if there are graph breaks), then this will raise an error. This also opts into unbacked semantics, notably it will turn on capture_scalar_outputs and capture_dynamic_output_shape_ops on by default.