          >>>         extract_media.set_image(image)
          >>>         <do intermediate processing>
          >>>         extractor.input_queue.put(extract_media)
          """
          retval = self._is_parallel or self.phase == self._final_phase
          logger.trace(retval)
          return retval
  
      def set_batchsize(self, plugin_type, batchsize):
          """ Set the batch size of a given :attr:`plugin_type` to the given :attr:`batchsize`.
 
</s> remove         retval = 1 if self._is_parallel else len(self._flow)
 </s> add         retval = len(self._phases)
        logger.trace(retval)
        return retval

    @property
    def phase_text(self):
        """ str: The plugins that are running in the current phase, formatted for info text
        output. """
        plugin_types = set(self._get_plugin_type_and_index(phase)[0]
                           for phase in self._current_phase)
        retval = ", ".join(plugin_type.title() for plugin_type in list(plugin_types)) </s> remove     @staticmethod
    def _set_plugin_batchsize(plugin, available_vram):
 </s> add     def _set_plugin_batchsize(self, gpu_plugins, available_vram): </s> remove 
        if self._is_parallel:
            for phase in self._flow:
                self._launch_plugin(phase)
        else:
            self._launch_plugin(self.phase)
 </s> add         for phase in self._current_phase:
            self._launch_plugin(phase) </s> remove             self.phase = self._next_phase
            logger.debug("Switching to %s phase", self.phase)
 </s> add             self._phase_index += 1
            logger.debug("Switching to phase: %s", self._current_phase) </s> remove         if plugin.vram_per_batch != 0:
            plugin.batchsize = int(max(1, available_vram // plugin.vram_per_batch))
            logger.verbose("Reset batchsize for %s to %s", plugin.name, plugin.batchsize)
 </s> add         plugins = [self._active_plugins[idx]
                   for idx, plugin in enumerate(self._current_phase)
                   if plugin in gpu_plugins]
        vram_per_batch = [plugin.vram_per_batch for plugin in plugins]
        ratios = [vram / sum(vram_per_batch) for vram in vram_per_batch]
        requested_batchsizes = [plugin.batchsize for plugin in plugins]
        batchsizes = [min(requested, max(1, int((available_vram * ratio) / plugin.vram_per_batch)))
                      for ratio, plugin, requested in zip(ratios, plugins, requested_batchsizes)]
        remaining = available_vram - sum(batchsize * plugin.vram_per_batch
                                         for batchsize, plugin in zip(batchsizes, plugins))
        sorted_indices = [i[0] for i in sorted(enumerate(plugins),
                                               key=lambda x: x[1].vram_per_batch, reverse=True)]

        logger.debug("requested_batchsizes: %s, batchsizes: %s, remaining vram: %s",
                     requested_batchsizes, batchsizes, remaining)

        while remaining > min(plugin.vram_per_batch
                              for plugin in plugins) and requested_batchsizes != batchsizes:
            for idx in sorted_indices:
                plugin = plugins[idx]
                if plugin.vram_per_batch > remaining:
                    logger.debug("Not enough VRAM to increase batch size of %s. Required: %sMB, "
                                 "Available: %sMB", plugin, plugin.vram_per_batch, remaining)
                    continue
                if plugin.batchsize == batchsizes[idx]:
                    logger.debug("Threshold reached for %s. Batch size: %s",
                                 plugin, plugin.batchsize)
                    continue
                logger.debug("Incrementing batch size of %s to %s", plugin, batchsizes[idx] + 1)
                batchsizes[idx] += 1
                remaining -= plugin.vram_per_batch
                logger.debug("Remaining VRAM to allocate: %sMB", remaining)

        if batchsizes != requested_batchsizes:
            text = ", ".join(["{}: {}".format(plugin.__class__.__name__, batchsize)
                              for plugin, batchsize in zip(plugins, batchsizes)])
            for plugin, batchsize in zip(plugins, batchsizes):
                plugin.batchsize = batchsize
            logger.info("Reset batch sizes due to available VRAM: %s", text)
        retval = self._phase_index == len(self._phases) - 1
          >>>         extract_media.set_image(image)
          >>>         <do intermediate processing>
          >>>         extractor.input_queue.put(extract_media)
          """
        retval = self._phase_index == len(self._phases) - 1
          logger.trace(retval)
          return retval
  
      def set_batchsize(self, plugin_type, batchsize):
          """ Set the batch size of a given :attr:`plugin_type` to the given :attr:`batchsize`.
keep keep keep keep replace keep keep keep keep keep
 Extract - Better VRAM Allocation in Extraction Pipeline 
plugins/extract/pipeline.py