メインコンテンツまでスキップ
バージョン: v2509

utils

staging_directory

def staging_directory(command: str, old_path: str, new_path: str) -> str

Replace directory paths in command and copy directory for distributed training.

Only rank 0 performs the copy operation.

Arguments:

  • command - The shell command string
  • old_path - Path to replace
  • new_path - New path to use

Returns:

Modified command string

Raises:

  • FileNotFoundError - If old_path doesn't exist
  • OSError - If copying fails

replace_params_to_file

def replace_params_to_file(input_filepath: str, output_filepath: str,
params: Dict[str, Any]) -> None

Replace parameters in a file with given values.

Arguments:

  • input_filepath str - Path to the input file.
  • output_filepath str - Path to the output file.
  • params Dict[str, Any] - Dictionary of parameters to replace.