espnet2.main_funcs.pack_funcs.unpack
Less than 1 minute
espnet2.main_funcs.pack_funcs.unpack
espnet2.main_funcs.pack_funcs.unpack(input_archive: Path | str, outpath: Path | str, use_cache: bool = True) → Dict[str, str]
Scan all files in the archive file and return as a dict of files.
This function extracts the contents of the specified archive and returns a dictionary mapping keys from the archive’s metadata to the paths of the extracted files. If a meta.yaml file is present in the archive, its contents will be used to determine the output file paths.
- Parameters:
- input_archive (Union *[*Path , str ]) – The path to the input archive file (e.g., .tar, .zip).
- outpath (Union *[*Path , str ]) – The output directory where files will be extracted.
- use_cache (bool) – Whether to use cached output if available. Defaults to True.
- Returns: A dictionary mapping keys to the paths of the extracted files.
- Return type: Dict[str, str]
- Raises:RuntimeError – If the format of the archive is incorrect or if meta.yaml is not found.
Examples
tarfile: : model.pth some1.file some2.file
>>> unpack("tarfile", "out")
{'asr_model_file': 'out/model.pth'}