Fix RuntimeError: Sharding is ambiguous for this dataset
#4
by
albertvillanova
HF Staff
- opened
ami.py
CHANGED
|
@@ -396,7 +396,7 @@ class AMI(datasets.GeneratorBasedBuilder):
|
|
| 396 |
gen_kwargs={
|
| 397 |
"annotation_path": annotation_path,
|
| 398 |
"samples_paths": train_path,
|
| 399 |
-
"ids": _TRAIN_SAMPLE_IDS,
|
| 400 |
"verification_ids": train_ids,
|
| 401 |
},
|
| 402 |
),
|
|
@@ -405,7 +405,7 @@ class AMI(datasets.GeneratorBasedBuilder):
|
|
| 405 |
gen_kwargs={
|
| 406 |
"annotation_path": annotation_path,
|
| 407 |
"samples_paths": validation_path,
|
| 408 |
-
"ids": _VALIDATION_SAMPLE_IDS,
|
| 409 |
"verification_ids": validation_ids,
|
| 410 |
},
|
| 411 |
),
|
|
@@ -414,7 +414,7 @@ class AMI(datasets.GeneratorBasedBuilder):
|
|
| 414 |
gen_kwargs={
|
| 415 |
"annotation_path": annotation_path,
|
| 416 |
"samples_paths": eval_path,
|
| 417 |
-
"ids": _EVAL_SAMPLE_IDS,
|
| 418 |
"verification_ids": eval_ids,
|
| 419 |
},
|
| 420 |
),
|
|
@@ -501,7 +501,7 @@ class AMI(datasets.GeneratorBasedBuilder):
|
|
| 501 |
sample_paths = samples_paths[num_audios * i : num_audios * (i + 1)]
|
| 502 |
sample_verification_id = set(verification_ids[num_audios * i : num_audios * (i + 1)])
|
| 503 |
|
| 504 |
-
# make sure that multi microphone samples are correctly
|
| 505 |
if len(sample_verification_id) > 1 or next(iter(sample_verification_id)) != _id:
|
| 506 |
raise ValueError(
|
| 507 |
f"Incorrect dataset generation. The files {sample_paths} of id {_id} have incorrect verification_ids {sample_verification_id}."
|
|
|
|
| 396 |
gen_kwargs={
|
| 397 |
"annotation_path": annotation_path,
|
| 398 |
"samples_paths": train_path,
|
| 399 |
+
"ids": tuple(_TRAIN_SAMPLE_IDS),
|
| 400 |
"verification_ids": train_ids,
|
| 401 |
},
|
| 402 |
),
|
|
|
|
| 405 |
gen_kwargs={
|
| 406 |
"annotation_path": annotation_path,
|
| 407 |
"samples_paths": validation_path,
|
| 408 |
+
"ids": tuple(_VALIDATION_SAMPLE_IDS),
|
| 409 |
"verification_ids": validation_ids,
|
| 410 |
},
|
| 411 |
),
|
|
|
|
| 414 |
gen_kwargs={
|
| 415 |
"annotation_path": annotation_path,
|
| 416 |
"samples_paths": eval_path,
|
| 417 |
+
"ids": tuple(_EVAL_SAMPLE_IDS),
|
| 418 |
"verification_ids": eval_ids,
|
| 419 |
},
|
| 420 |
),
|
|
|
|
| 501 |
sample_paths = samples_paths[num_audios * i : num_audios * (i + 1)]
|
| 502 |
sample_verification_id = set(verification_ids[num_audios * i : num_audios * (i + 1)])
|
| 503 |
|
| 504 |
+
# make sure that multi microphone samples are correctly attributed to labels
|
| 505 |
if len(sample_verification_id) > 1 or next(iter(sample_verification_id)) != _id:
|
| 506 |
raise ValueError(
|
| 507 |
f"Incorrect dataset generation. The files {sample_paths} of id {_id} have incorrect verification_ids {sample_verification_id}."
|