i6_core.returnn.compile

class i6_core.returnn.compile.CompileNativeOpJob(*args, **kwargs)

Compile a RETURNN native op into a shared object file.

Parameters:
  • native_op (str) – Name of the native op to compile (e.g. NativeLstm2)

  • returnn_python_exe (Optional[Path]) – file path to the executable for running returnn (python binary or .sh)

  • returnn_root (Optional[Path]) – file path to the RETURNN repository root folder

  • search_numpy_blas (bool) – search for blas lib in numpy’s .libs folder

  • blas_lib (Path|str) – explicit path to the blas library to use

run()
tasks()
Returns:

yields Task’s

Return type:

list[sisyphus.task.Task]

class i6_core.returnn.compile.CompileTFGraphJob(*args, **kwargs)

This Job is a wrapper around the RETURNN tool compile_tf_graph.py

Parameters:
  • returnn_config (ReturnnConfig|Path|str) – Path to a RETURNN config file

  • train (int) –

  • eval (int) –

  • search (int) –

  • epoch (int|tk.Variable|None) – compile a specific epoch for networks that might change with every epoch

  • log_verbosity (int) – RETURNN log verbosity from 1 (least verbose) to 5 (most verbose)

  • device (str|None) – optimize graph for cpu or gpu. If None, defaults to cpu for current RETURNN. For any RETURNN version before cd4bc382, the behavior will depend on the device entry in the returnn_conig, or on the availability of a GPU on the execution host if not defined at all.

  • summaries_tensor_name

  • output_format (str) – graph output format, one of [“pb”, “pbtxt”, “meta”, “metatxt”]

  • returnn_python_exe (Optional[Path]) – file path to the executable for running returnn (python binary or .sh)

  • returnn_root (Optional[Path]) – file path to the RETURNN repository root folder

  • rec_step_by_step (Optional[str]) – name of rec layer for step-by-step graph

  • rec_json_info (bool) – whether to enable rec json info for step-by-step graph compilation

classmethod hash(kwargs)
Parameters:

parsed_args (dict[str]) –

Returns:

hash for job given the arguments

Return type:

str

run()
tasks()
Returns:

yields Task’s

Return type:

list[sisyphus.task.Task]

class i6_core.returnn.compile.TorchOnnxExportJob(*args, **kwargs)

Export an ONNX model using the appropriate RETURNN tool script.

Currently only supports PyTorch via tools/torch_export_to_onnx.py

Parameters:
  • returnn_config – RETURNN config object

  • checkpoint – Path to the checkpoint for export

  • device – target device for graph creation

  • returnn_python_exe – file path to the executable for running returnn (python binary or .sh)

  • returnn_root – file path to the RETURNN repository root folder

run()
tasks()
Returns:

yields Task’s

Return type:

list[sisyphus.task.Task]