espnet3.parallel.base_runner.convert_paths
Less than 1 minute
espnet3.parallel.base_runner.convert_paths
espnet3.parallel.base_runner.convert_paths(obj)
Recursively convert pathlib.Path objects to strings.
This is primarily used to make configs and environment objects JSON serializable before sending them to Dask workers.
- Parameters:obj – Arbitrary nested structure containing dict/list/Path leaves.
- Returns: A new structure where all
Pathinstances are converted tostr. - Return type: Any
Example
>>> from pathlib import Path
>>> convert_paths({"p": Path("a/b")})
{'p': 'a/b'}