self._state_dict["previous_state_example_idx"] = current_idx
        else:
            for key, example in iterator:
                # If not batched, we can apply the transform and yield the example directly
                # first copy the example, since we might drop some keys
                example = dict(example)
                example = format_dict(example) if format_dict else example
                # then apply the transform
                inputs = example
                function_args = [inputs] if self.input_columns is None else [inputs[col] for col in self.input_columns]
                if self.with_indices:
                    function_args.append(current_idx)
                processed_inputs = self.function(*function_args, **self.fn_kwargs)
                inputs_to_merge = dict(example)
                # this logic mimics the one in Dataset.map
                if self.remove_columns:
                    for c in self.remove_columns: