mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-09-09 00:54:18 +00:00
fix type error of dst_manifest_dir
This commit is contained in:
parent
50641cdeab
commit
85f35698ef
@ -75,8 +75,10 @@ class CodebookIndexExtractor:
|
|||||||
self.manifest_dir = self.vq_dir / f"splits{self.params.world_size}"
|
self.manifest_dir = self.vq_dir / f"splits{self.params.world_size}"
|
||||||
self.manifest_dir.mkdir(parents=True, exist_ok=True)
|
self.manifest_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
self.ori_manifest_dir = "./data/fbank/"
|
# It's doesn't matter whether ori_manifest_dir is str or Path.
|
||||||
self.dst_manifest_dir = "./data/vq_fbank/"
|
# Set it to Path to be consistent.
|
||||||
|
self.ori_manifest_dir = Path("./data/fbank/")
|
||||||
|
self.dst_manifest_dir = Path("./data/vq_fbank/")
|
||||||
|
|
||||||
self.dst_manifest_dir.mkdir(parents=True, exist_ok=True)
|
self.dst_manifest_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
@ -251,6 +253,8 @@ class CodebookIndexExtractor:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Type of self.ori_nanifest_dir is Path
|
||||||
|
# and result type of glob.glob is str.
|
||||||
reusable_manifests = [
|
reusable_manifests = [
|
||||||
manifest
|
manifest
|
||||||
for manifest in glob.glob(f"{self.ori_manifest_dir}/*.gz")
|
for manifest in glob.glob(f"{self.ori_manifest_dir}/*.gz")
|
||||||
@ -258,9 +262,11 @@ class CodebookIndexExtractor:
|
|||||||
]
|
]
|
||||||
for manifest_path in reusable_manifests:
|
for manifest_path in reusable_manifests:
|
||||||
ori_manifest_path = Path(manifest_path).resolve()
|
ori_manifest_path = Path(manifest_path).resolve()
|
||||||
|
# Path cannot used as a parameter of str.replace.
|
||||||
|
# Cast them to str.
|
||||||
dst_manifest_path = Path(
|
dst_manifest_path = Path(
|
||||||
manifest_path.replace(
|
manifest_path.replace(
|
||||||
self.ori_manifest_dir, self.dst_manifest_dir
|
str(self.ori_manifest_dir), str(self.dst_manifest_dir)
|
||||||
)
|
)
|
||||||
).resolve()
|
).resolve()
|
||||||
if not dst_manifest_path.exists():
|
if not dst_manifest_path.exists():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user