class documentation
class LocalMapper(Mapper, abc.ABC): (source)
Known subclasses: fiftyone.core.map.process.ProcessMapper
, fiftyone.core.map.threading.ThreadMapper
Constructor: LocalMapper(batch_cls, num_workers, batch_size)
Base class for mapping samples in parallelizing on the same machine
Method | _map |
of the results. |
Method | _map |
of the results. |
Inherited from Mapper
:
Class Method | create |
Create a new mapper instance |
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 |
def _map_samples(self, sample_collection:
SampleCollection[ T]
, map_fcn: Callable[ [ T], R]
, *, progress: bool | Literal[ 'workers'] | None
= None, save: bool
= False, skip_failures: bool
= True) -> Iterator[ tuple[ bson.ObjectId, 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 |
|
@abc.abstractmethod
def _map_samples_multiple_workers(self, sample_collection:
def _map_samples_multiple_workers(self, sample_collection:
SampleCollection[ T]
, map_fcn: Callable[ [ T], R]
, *, progress: bool | Literal[ 'workers'] | None
, save: bool
, skip_failures: bool
) -> Iterator[ tuple[ bson.ObjectId, Exception | None, R | None]]
:
(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 |
|