def add_samples(
        self,
        samples,
        expand_schema=True,
        dynamic=False,
        validate=True,
        generator=False,
        progress=None,
        num_samples=None,
    ):
        """Adds the given samples to the dataset.

        Any sample instances that do not belong to a dataset are updated
        in-place to reflect membership in this dataset. Any sample instances
        that belong to other datasets are not modified.

        Args:
            samples: an iterable of :class:`fiftyone.core.sample.Sample`
                instances or a
                :class:`fiftyone.core.collections.SampleCollection`
            expand_schema (True): whether to dynamically add new sample fields
                encountered to the dataset schema. If False, an error is raised
                if a sample's schema is not a subset of the dataset schema
            dynamic (False): whether to declare dynamic attributes of embedded
                document fields that are encountered
            validate (True): whether to validate that the fields of each sample
                are compliant with the dataset schema before adding it
            generator (False): whether to yield ID batches as a generator as
                samples are added to the dataset
            progress (None): whether to render a progress bar (True/False), use
                the default value ``fiftyone.config.show_progress_bars``
                (None), or a progress callback function to invoke instead
            num_samples (None): the number of samples in ``samples``. If not
                provided, this is computed (if possible) via ``len(samples)``
                if needed for progress tracking

        Returns:
            a list of IDs of the samples in the dataset
        """
        if num_samples is None:
            num_samples = samples

        transform_fn = partial(
            self._transform_sample,
            expand_schema=expand_schema,
            dynamic=dynamic,
            validate=validate,
            copy=True,
        )

        batcher = fou.get_default_batcher(
            samples,
            transform_fn=transform_fn,
            size_calc_fn=self._calculate_size,
            progress=progress,
            total=num_samples,
        )

        def _do_add_samples():
            with batcher:
                for batch in batcher:
                    res, ids = self._add_samples_batch(batch)
                    if hasattr(res, "nBytes") and hasattr(
                        batcher, "set_encoding_ratio"
                    ):
                        batcher.set_encoding_ratio(res.nBytes)

                    yield ids

        if generator:
            return _do_add_samples()

        sample_ids = []
        for ids in _do_add_samples():
            sample_ids.extend(ids)

        return sample_ids
Adds the given samples to the dataset.

        Any sample instances that do not belong to a dataset are updated
        in-place to reflect membership in this dataset. Any sample instances
        that belong to other datasets are not modified.

        Args:
            samples: an iterable of :class:`fiftyone.core.sample.Sample`
                instances or a
                :class:`fiftyone.core.collections.SampleCollection`
            expand_schema (True): whether to dynamically add new sample fields
                encountered to the dataset schema. If False, an error is raised
                if a sample's schema is not a subset of the dataset schema
            dynamic (False): whether to declare dynamic attributes of embedded
                document fields that are encountered
            validate (True): whether to validate that the fields of each sample
                are compliant with the dataset schema before adding it
            generator (False): whether to yield ID batches as a generator as
                samples are added to the dataset
            progress (None): whether to render a progress bar (True/False), use
                the default value ``fiftyone.config.show_progress_bars``
                (None), or a progress callback function to invoke instead
            num_samples (None): the number of samples in ``samples``. If not
                provided, this is computed (if possible) via ``len(samples)``
                if needed for progress tracking

        Returns:
            a list of IDs of the samples in the dataset
        
fiftyone/core/dataset.py