tft_register_rename_handler

Function

Registers the rename callback function in the framework.

For MindSpeed-LLM, the callback function has been adapted by MindIO TFT. For other frameworks, you need to ensure the security of the callback function.

Format

mindio_ttp.framework_ttp.tft_register_rename_handler(func: Callable, ctx = None)

Parameters

Parameter

Mandatory/Optional

Description

Value

func

Mandatory

rename function, which is used to re-name the dying gasp checkpoint that is successfully saved. The naming rule is the same as that of the native framework checkpoint.

The callback function cannot be empty. For details about the input parameters of the callback function, see Callback function parameters. The callback function has no return value. If the execution fails, an exception is thrown.

ctx

Optional

Callback function context.

This parameter is left empty by default.

Table 1 Parameters of the MindSpore callback function

Parameter

Mandatory/Optional

Description

Value

step

-

Step for dumping optimizer data.

Positive integer

ctx

-

Callback function context.

Determined by the registration party.

Table 2 Parameters of the non-MindSpore callback function

Parameter

Mandatory/Optional

Description

Value

step

-

Step for dumping optimizer data.

Positive integer

args

-

Parameter set by tft_set_step_args.

Determined by the registration party.

Return Value

No return value. If an error occurs, an error log is recorded and an exception is thrown.