Skip to content

Commit 2f8b0c0

Browse files
JanuszLclaude
andcommitted
Address PR review comments: paramlinks and shuffle_after_epoch_seed warning.
- Use single backticks for parameter references in shuffle_after_epoch_seed docstrings across all 5 reader ops so sphinx_paramlinks creates links. - Warn when shuffle_after_epoch_seed is provided but shuffle_after_epoch=False in FileLoader, FileLabelLoaderBase, and NemoAsrLoader. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c616299 commit 2f8b0c0

8 files changed

Lines changed: 21 additions & 12 deletions

File tree

dali/operators/reader/coco_reader_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ properties.
103103
104104
.. note::
105105
When using multiple DALI pipelines (e.g., for multi-GPU training), all pipeline
106-
instances should use the same ``shuffle_after_epoch_seed`` to ensure a consistent
106+
instances should use the same `shuffle_after_epoch_seed` to ensure a consistent
107107
global shuffle across all shards.
108108
109109
.. note::
110-
This argument has no effect unless ``shuffle_after_epoch`` is set to ``True``.)code",
110+
This argument has no effect unless `shuffle_after_epoch` is set to ``True``.)code",
111111
nullptr, false)
112112
.AddOptionalArg<string>("file_root",
113113
R"code(Path to a directory that contains the data files.

dali/operators/reader/file_reader_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ properties.
108108
109109
.. note::
110110
When using multiple DALI pipelines (e.g., for multi-GPU training), all pipeline
111-
instances should use the same ``shuffle_after_epoch_seed`` to ensure a consistent
111+
instances should use the same `shuffle_after_epoch_seed` to ensure a consistent
112112
global shuffle across all shards.
113113
114114
.. note::
115-
This argument has no effect unless ``shuffle_after_epoch`` is set to ``True``.)",
115+
This argument has no effect unless `shuffle_after_epoch` is set to ``True``.)",
116116
nullptr, false)
117117
.AddOptionalArg<vector<string>>("files", R"(A list of file paths to read the data from.
118118

dali/operators/reader/fits_reader_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ properties.
8181
8282
.. note::
8383
When using multiple DALI pipelines (e.g., for multi-GPU training), all pipeline
84-
instances should use the same ``shuffle_after_epoch_seed`` to ensure a consistent
84+
instances should use the same `shuffle_after_epoch_seed` to ensure a consistent
8585
global shuffle across all shards.
8686
8787
.. note::
88-
This argument has no effect unless ``shuffle_after_epoch`` is set to ``True``.)",
88+
This argument has no effect unless `shuffle_after_epoch` is set to ``True``.)",
8989
nullptr, false)
9090
.AddOptionalArg<vector<string>>("files", R"(A list of file paths to read the data from.
9191

dali/operators/reader/loader/file_label_loader.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ class DLL_PUBLIC FileLabelLoaderBase : public Loader<CPUBackend, ImageLabelWrapp
5959
current_index_(0),
6060
current_epoch_(0) {
6161
int32_t seed_arg = kDaliDataloaderSeed;
62-
spec.TryGetArgument(seed_arg, "shuffle_after_epoch_seed");
62+
bool has_seed_arg = spec.TryGetArgument(seed_arg, "shuffle_after_epoch_seed");
6363
shuffle_after_epoch_seed_ = seed_arg;
64+
if (has_seed_arg && !shuffle_after_epoch_) {
65+
DALI_WARN("`shuffle_after_epoch_seed` has no effect when `shuffle_after_epoch` is False.");
66+
}
6467

6568
vector<string> files;
6669
vector<int> labels;

dali/operators/reader/loader/file_loader.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ class FileLoader : public Loader<Backend, Target, true> {
5151
current_index_(0),
5252
current_epoch_(0) {
5353
int32_t seed_arg = kDaliDataloaderSeed;
54-
spec.TryGetArgument(seed_arg, "shuffle_after_epoch_seed");
54+
bool has_seed_arg = spec.TryGetArgument(seed_arg, "shuffle_after_epoch_seed");
5555
shuffle_after_epoch_seed_ = seed_arg;
56+
if (has_seed_arg && !shuffle_after_epoch_) {
57+
DALI_WARN("`shuffle_after_epoch_seed` has no effect when `shuffle_after_epoch` is False.");
58+
}
5659
vector<string> files;
5760

5861
file_discovery_opts_.label_from_subdir = false;

dali/operators/reader/loader/nemo_asr_loader.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ class DLL_PUBLIC NemoAsrLoader : public Loader<CPUBackend, AsrSample, true> {
129129
decode_scratch_(num_threads_),
130130
resample_scratch_(num_threads_) {
131131
DALI_ENFORCE(!manifest_filepaths_.empty(), "``manifest_filepaths`` can not be empty");
132+
if (spec.HasArgument("shuffle_after_epoch_seed") && !shuffle_after_epoch_) {
133+
DALI_WARN("`shuffle_after_epoch_seed` has no effect when `shuffle_after_epoch` is False.");
134+
}
132135
/*
133136
* Those options are mutually exclusive as `shuffle_after_epoch` will make every shard looks
134137
* differently after each epoch so coexistence with `stick_to_shard` doesn't make any sense

dali/operators/reader/nemo_asr_reader_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ properties.
9696
9797
.. note::
9898
When using multiple DALI pipelines (e.g., for multi-GPU training), all pipeline
99-
instances should use the same ``shuffle_after_epoch_seed`` to ensure a consistent
99+
instances should use the same `shuffle_after_epoch_seed` to ensure a consistent
100100
global shuffle across all shards.
101101
102102
.. note::
103-
This argument has no effect unless ``shuffle_after_epoch`` is set to ``True``.)code",
103+
This argument has no effect unless `shuffle_after_epoch` is set to ``True``.)code",
104104
nullptr, false)
105105
.AddOptionalArg("sample_rate",
106106
"If specified, the target sample rate, in Hz, to which the audio is resampled.",

dali/operators/reader/numpy_reader_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ properties.
147147
148148
.. note::
149149
When using multiple DALI pipelines (e.g., for multi-GPU training), all pipeline
150-
instances should use the same ``shuffle_after_epoch_seed`` to ensure a consistent
150+
instances should use the same `shuffle_after_epoch_seed` to ensure a consistent
151151
global shuffle across all shards.
152152
153153
.. note::
154-
This argument has no effect unless ``shuffle_after_epoch`` is set to ``True``.)",
154+
This argument has no effect unless `shuffle_after_epoch` is set to ``True``.)",
155155
nullptr, false)
156156
.AddOptionalArg<vector<string>>("files", R"(A list of file paths to read the data from.
157157

0 commit comments

Comments
 (0)