dataloader
FEDataLoader
¶
Bases: DataLoader
A Data Loader that can handle filtering data.
This class is intentionally not @traceable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
MapDataset
|
The dataset to be drawn from. The dataset may optionally implement .fe_reset_ds(bool) and/or .fe_batch_indices(int) methods to modify the system's sampling behavior. See fe.dataset.BatchDataset for an example which uses both of these methods. |
required |
postprocess_fn |
Optional[PostProcessFunction]
|
A function to run on a collated batch of data before returning it. This function can return a FilteredData object in order to drop the given batch. |
None
|
batch_size |
Optional[int]
|
The batch size to use (or None if the dataset is already providing a batch). |
1
|
steps_per_epoch |
Optional[int]
|
How many steps to have per epoch. If None the loader will perform a single pass through the
dataset (unless samples are filtered with replacement, in which case the dataset may be passed over multiple
times). If |
None
|
shuffle |
bool
|
Whether to shuffle the dataset. |
False
|
num_workers |
int
|
How many multiprocessing threads to use (unix/mac only). |
0
|
collate_fn |
Optional[Callable]
|
What function to use to collate a list of data into a batch. This should take care of any desired padding. |
None
|
drop_last |
bool
|
Whether to drop the last batch of data if that batch is incomplete. Note that this is meaningless for
batched datasets, as well as when |
False
|
Source code in fastestimator/fastestimator/dataset/dataloader.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
shutdown
¶
Close the worker threads used by this iterator.
The hope is that this will prevent "RuntimeError: DataLoader worker (pid(s) XXXX) exited unexpectedly" during the test suites.
Source code in fastestimator/fastestimator/dataset/dataloader.py
InfiniteSampler
¶
Bases: Sampler
A class which never stops sampling.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_source |
Sized
|
The dataset to be sampled. |
required |
shuffle |
bool
|
Whether to shuffle when sampling. |
True
|
reset_fn |
Optional[Callable[[bool], None]]
|
A function to be invoked (using the provided |
None
|
convert_fn |
Optional[Callable[[int], Any]]
|
A function to be invoked (using the current index) every sample in order to convert an integer index into some arbitrary alternative index representation. |
None
|