You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/making_dataloaders.rst
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,13 @@ takes an ``enum`` provided by :class:`ffcv.loader.OrderOption`:
49
49
# Memory-efficient but not truly random loading
50
50
# Speeds up loading over RANDOM when the whole dataset does not fit in RAM!
51
51
ORDERING= OrderOption.QUASI_RANDOM
52
+
53
+
.. note::
54
+
``order`` options require different amounts of RAM, thus should be used considering how much RAM available in a case-by-case basis.
55
+
56
+
- ``RANDOM`` requires RAM the most since it will have to cache the entire dataset to sample perfectly at random. If the available RAM is not enough, it will throw an exception.
57
+
- ``QUASI_RANDOM`` requires much less RAM than ``RANDOM``, but a bit more than ``SEQUENTIAL``, in order to cache a part of samples. It is used when the entire dataset can not fit RAM.
58
+
- ``SEQUENTIAL`` requires least RAM. It only keeps several samples loaded ahead of time used in incoming training iterations.
52
59
53
60
Pipelines
54
61
'''''''''
@@ -165,12 +172,12 @@ Other options
165
172
166
173
You can also specify the following additional options when constructing an :class:`ffcv.loader.Loader`:
167
174
168
-
- ``os_cache``: If True, the entire dataset is cached
175
+
- ``os_cache``: If ``True``, the OS automatically determines whether the dataset is held in memory or not, depending on available RAM. If ``False``, FFCV manages the caching, and the amount of RAM needed depends on ``order`` option.
169
176
- ``distributed``: For training on :ref:`multiple GPUs<Scenario: Multi-GPU training (1 model, multiple GPUs)>`
170
177
- ``seed``: Specify the random seed for batch ordering
171
178
- ``indices``: Provide indices to load a subset of the dataset
172
179
- ``custom_fields``: For specifying decoders for fields with custom encoders
173
-
- ``drop_last``: If True, drops the last non-full batch from each iteration
180
+
- ``drop_last``: If ``True``, drops the last non-full batch from each iteration
174
181
- ``batches_ahead``: Set the number of batches prepared in advance. Increasing it absorbs variation in processing time to make sure the training loop does not stall for too long to process batches. Decreasing it reduces RAM usage.
175
182
- ``recompile``: Recompile every iteration. Useful if you have transforms that change their behavior from epoch to epoch, for instance code that uses the shape as a compile time param. (But if they just change their memory usage, e.g., the resolution changes, it's not necessary.)
Copy file name to clipboardExpand all lines: docs/parameter_tuning.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Scenario: Large scale datasets
22
22
If your dataset is too large to be cached on the machine we recommend:
23
23
24
24
- Use ``os_cache=False``. Since the data can't be cached, FFCV will have to read it over and over. Having FFCV take over the operating system for caching is beneficial as it knows in advance the which samples will be needed in the future and can load them ahead of time.
25
-
- For ``order``, we recommend using the ``QUASI_RANDOM`` traversal order if you need randomness but perfect uniform sampling isn't mission critical. This will optimize the order to minimize the reads on the underlying storage while maintaining very good randomness properties. If you have experience with the ``shuffle()`` function of ``webdataset`` and the quality of the randomness wasn't sufficient, we still suggest you give ``QUASI_RANDOM`` a try as it should be significantly better.
25
+
- For ``order``, we recommend using the ``QUASI_RANDOM`` traversal order if you need randomness but perfect uniform sampling isn't mission critical. This will optimize the order to minimize the reads on the underlying storage while maintaining very good randomness properties. If you have experience with the ``shuffle()`` function of ``webdataset`` and the quality of the randomness wasn't sufficient, we still suggest you give ``QUASI_RANDOM`` a try as it should be significantly better. Using ``RANDOM`` is unfeasible in this situation because it needs to load the entire dataset in RAM, causing an out-of-memory exception.
26
26
27
27
28
28
Scenario: Multi-GPU training (1 model, multiple GPUs)
0 commit comments