Show real-time HF parquet download & indexing progress in dataset.py
Browse files174 unmodified lines175176177178179180181182183184185186187188189190174 unmodified lines):from huggingface_hub import HfApi, hf_hub_downloadapi = HfApi()revision = api.dataset_info(repo_id).shaall_files = api.list_repo_files(repo_id=repo_id, repo_type="dataset", revision=revision)parquet_files = [f for f in sorted(all_files)if f.endswith(".parquet") and any(f.startswith(sub.rstrip("/") + "/") for sub in data_subdirs)]for filename in parquet_files:path = hf_hub_download(repo_id=repo_id, filename=filename, repo_type="dataset", revision=revision)self._load_local_parquets([path], target_speaker, target_gender, max_samples)if max_samples and len(self.rows) >= max_samples:break174 unmodified lines175176177178179180181182183184185186187188189190191192193194195196197198199174 unmodified lines):from huggingface_hub import HfApi, hf_hub_downloadapi = HfApi(token=os.getenv("HF_TOKEN"))revision = api.dataset_info(repo_id).shaall_files = api.list_repo_files(repo_id=repo_id, repo_type="dataset", revision=revision)parquet_files = [f for f in sorted(all_files)if f.endswith(".parquet") and any(f.startswith(sub.rstrip("/") + "/") for sub in data_subdirs)]print(f"[Dataset] Found {len(parquet_files)} parquet shards in {repo_id} ({data_subdirs})", flush=True)for idx, filename in enumerate(parquet_files, start=1):print(f"[Download {idx}/{len(parquet_files)}] Fetching {filename} ...", flush=True)path = hf_hub_download(repo_id=repo_id,filename=filename,repo_type="dataset",revision=revision,token=os.getenv("HF_TOKEN"),)self._load_local_parquets([path], target_speaker, target_gender, max_samples)print(f"[Indexed {idx}/{len(parquet_files)}] Matched clips so far: {len(self.rows)}", flush=True)if max_samples and len(self.rows) >= max_samples:break
data/dataset.py+12-3