Don't cache dataloader by default, raise if there is no valid path

This commit is contained in:
enhuiz 2023-01-18 10:20:20 +08:00
parent 2a68378421
commit 2e9f5030a3
2 changed files with 8 additions and 1 deletions

View File

@ -48,6 +48,8 @@ class Config(ConfigBase):
gradient_accumulation_steps: int = 1
sampling_temperature: float = 1.0
cache_dataloader: bool = False
@cached_property
def get_spkr(self):
return eval(self.spkr_name_getter)
@ -87,7 +89,9 @@ class Config(ConfigBase):
@cached_property
def diskcache(self):
return diskcache.Cache(self.cache_dir).memoize
if self.cache_dataloader:
return diskcache.Cache(self.cache_dir).memoize
return lambda: lambda x: x
cfg = Config.from_cli()

View File

@ -105,6 +105,9 @@ class VALLEDatset(Dataset):
p for p in self.paths if len(self.paths_by_spkr_name[_get_spkr_name(p)]) > 1
]
if len(self.paths) == 0:
raise ValueError("No valid path is found. ")
if training:
self.sampler = Sampler(self.paths, [_get_spkr_name])
else: