class documentation
class ThreadMapper(fomm.LocalMapper): (source)
Constructor: ThreadMapper(batch_cls, num_workers, batch_size)
Executes map_samples with threading using iter_samples.
Class Method | create |
Create a new mapper instance |
Static Method | __worker |
Undocumented |
Method | _map |
of the results. |
Inherited from LocalMapper
:
Method | _map |
of the results. |
Inherited from Mapper
(via LocalMapper
):
Method | __init__ |
Undocumented |
Method | map |
Applies map function to each sample and returns an iterator of the results. |
Property | batch |
Number of samples per worker batch |
Property | num |
Number of workers to use |
Static Method | _handle |
Common error handling when a map error occurs |
Instance Variable | _batch |
Undocumented |
Instance Variable | _batch |
Undocumented |
Instance Variable | _num |
Undocumented |
@classmethod
def create(cls, *, config:
def create(cls, *, config:
focc.FiftyOneConfig
, batch_cls: type[ fomb.SampleBatch]
, num_workers: int | None
= None, batch_size: int | None
= None, **__):
(source)
¶
overrides
fiftyone.core.map.mapper.Mapper.create
Create a new mapper instance
@staticmethod
def __worker(*, cancel_event:
def __worker(*, cancel_event:
threading.Event
, result_queue: ResultQueue[ R]
, map_fcn: Callable[ [ T], R]
, sample_iter: Iterator[ T]
, skip_failures: bool
, worker_done_event: threading.Event
, progress_bar: tqdm | None
= None):
(source)
¶
Undocumented
def _map_samples_multiple_workers(self, sample_collection:
SampleCollection[ T]
, map_fcn: Callable[ [ T], R]
, *, progress: bool | Literal[ 'workers'] | Callable
, save: bool
, skip_failures: bool
) -> Iterator[ tuple[ bson.ObjectId, Exception | None, R]]
:
(source)
¶
- Applies map function to each sample batch and returns an iterator
- of the results.
Parameters | |
sampleSampleCollection[T] | The sample collection to map. |
mapCallable[[T] , R] | The map function to apply to each sample. |
progress:Union[bool , Literal[ "workers"]] | Whether or not and how to render progress. |
save:bool , optional | Whether to save mutated samples mutated in the map function. Defaults to False. |
skipbool , optional | Whether to gracefully continue without raising an error if the map function raises an exception for a sample. Defaults to True. |
Returns | |
Iterator[ | Undocumented |
Yields | |
MapSampleBatchesReturnType |
|