                     "editing the plugin settings (GUI: Settings > Configure extract settings, "
                     "CLI: Edit the file faceswap/config/extract.ini)."
                     "\n3) Enable 'Single Process' mode.")
              raise FaceswapError(msg) from err
          except Exception as err:
              if get_backend() == "amd":
                  # pylint:disable=import-outside-toplevel
                  from lib.plaidml_utils import is_plaidml_error
                  if (is_plaidml_error(err) and (
                          "CL_MEM_OBJECT_ALLOCATION_FAILURE" in str(err).upper() or
                          "enough memory for the current schedule" in str(err).lower())):
                      msg = ("You do not have enough GPU memory available to run detection at "
                             "the selected batch size. You can try a number of things:"
                             "\n1) Close any other application that is using your GPU (web "
                             "browsers are particularly bad for this)."
                             "\n2) Lower the batchsize (the amount of images fed into the "
                             "model) by editing the plugin settings (GUI: Settings > Configure "
                             "extract settings, CLI: Edit the file "
                             "faceswap/config/extract.ini).")
                      raise FaceswapError(msg) from err
              raise
  
      def finalize(self, batch: BatchType) -> Generator[ExtractMedia, None, None]:
          """ Finalize the output from Masker
  
          This should be called as the final task of each `plugin`.
 
</s> remove         except Exception as err:
            if get_backend() == "amd":
                # pylint:disable=import-outside-toplevel
                from lib.plaidml_utils import is_plaidml_error
                if (is_plaidml_error(err) and (
                        "CL_MEM_OBJECT_ALLOCATION_FAILURE" in str(err).upper() or
                        "enough memory for the current schedule" in str(err).lower())):
                    msg = ("You do not have enough GPU memory available to train the selected "
                           "model at the selected settings. You can try a number of things:"
                           "\n1) Close any other application that is using your GPU (web browsers "
                           "are particularly bad for this)."
                           "\n2) Lower the batchsize (the amount of images fed into the model "
                           "each iteration)."
                           "\n3) Use a more lightweight model, or select the model's 'LowMem' "
                           "option (in config) if it has one.")
                    raise FaceswapError(msg) from err
            raise
 </s> add  </s> remove             loss: List[float] = self._model.model.train_on_batch(model_inputs, y=model_targets)
 </s> add             loss: T.List[float] = self._model.model.train_on_batch(model_inputs, y=model_targets) </s> remove         if get_backend() == "amd":  # Expand out AMD inputs + targets
            model_inputs = [inp for side in model_inputs for inp in side]  # type: ignore
            model_targets = [tgt for side in model_targets for tgt in side]  # type: ignore
 </s> add  </s> remove     fc_depth=dict(
        default=1,
        info="The number of consecutive Dense (fully connected) layers to include in each side's "
             "intermediate layer.",
        datatype=int,
        rounding=1,
        min_max=(0, 16),
        group="hidden layers",
        fixed=True),
    fc_min_filters=dict(
        default=1024,
        info="The number of filters to use for the initial fully connected layer. The number of "
             "nodes actually used is: fc_min_filters x fc_dimensions x fc_dimensions.\nNB: This "
             "value may be scaled down, depending on output resolution.",
        datatype=int,
        rounding=16,
        min_max=(16, 5120),
        group="hidden layers",
        fixed=True),
    fc_max_filters=dict(
        default=1024,
        info="This is the number of filters to be used in the final reshape layer at the end of "
             "the fully connected layers. The actual number of nodes used for the final fully "
             "connected layer is: fc_min_filters x fc_dimensions x fc_dimensions.\nNB: This value "
             "may be scaled down, depending on output resolution.",
        datatype=int,
        rounding=64,
        min_max=(128, 5120),
        group="hidden layers",
        fixed=True),
    fc_dimensions=dict(
        default=4,
        info="The height and width dimension for the final reshape layer at the end of the fully "
             "connected layers.\nNB: The total number of nodes within the final fully connected "
             "layer will be: fc_dimensions x fc_dimensions x fc_max_filters.",
        datatype=int,
        rounding=1,
        min_max=(1, 16),
        group="hidden layers",
        fixed=True),
    fc_filter_slope=dict(
        default=-0.5,
        info="The rate that the filters move from the minimum number of filters to the maximum "
             "number of filters. EG:\n"
             "Negative numbers will change the number of filters quicker at first and slow down "
             "each layer.\n"
             "Positive numbers will change the number of filters slower at first but then speed "
             "up each layer.\n"
             "0.0 - This will change at a linear rate (i.e. the same number of filters will be "
             "changed at each layer).",
        datatype=float,
        min_max=(-.99, .99),
        rounding=2,
        group="hidden layers",
        fixed=True),
    fc_dropout=dict(
        default=0.0,
        info="Dropout is a form of regularization that can prevent a model from over-fitting and "
             "help to keep neurons 'alive'. 0.5 will dropout half the connections between each "
             "fully connected layer, 0.25 will dropout a quarter of the connections etc. Set to "
             "0.0 to disable.",
        datatype=float,
        rounding=2,
        min_max=(0.0, 0.99),
        group="hidden layers",
        fixed=False),
    fc_upsampler=dict(
        default="upsample2d",
        info="The type of dimensional upsampling to perform at the end of the fully connected "
             "layers, if upsamples > 0. The number of filters used for the upscale layers will be "
             "the value given in 'fc_upsample_filters'."
             "\n\tupsample2d - A lightweight and VRAM friendly method. 'quick and dirty' but does "
             "not learn any parameters"
             "\n\tsubpixel - Sub-pixel upscaler using depth-to-space which may require more "
             "VRAM."
             "\n\tresize_images - Uses the Keras resize_image function to save about half as much "
             "vram as the heaviest methods."
             "\n\tupscale_fast - Developed by Andenixa. Focusses on speed to upscale, but "
             "requires more VRAM."
             "\n\tupscale_hybrid - Developed by Andenixa. Uses a combination of PixelShuffler and "
             "Upsampling2D to upscale, saving about 1/3rd of VRAM of the heaviest methods.",
        datatype=str,
        choices=["resize_images", "subpixel", "upscale_fast", "upscale_hybrid", "upsample2d"],
        group="hidden layers",
        gui_radio=False,
        fixed=True),
    fc_upsamples=dict(
        default=1,
        info="Some upsampling can occur within the Fully Connected layers rather than in the "
             "Decoder to increase the dimensional space. Set how many upscale layers should occur "
             "within the Fully Connected layers.",
        datatype=int,
        min_max=(0, 4),
        rounding=1,
        group="hidden layers",
        fixed=True),
    fc_upsample_filters=dict(
        default=512,
        info="If you have selected an upsampler which requires filters (i.e. any upsampler with "
             "the exception of Upsampling2D), then this is the number of filters to be used for "
             "the upsamplers within the fully connected layers,  NB: This value may be scaled "
             "down, depending on output resolution. Also note, that this figure will dictate the "
             "number of filters used for the G-Block, if selected.",
        datatype=int,
        rounding=64,
        min_max=(128, 5120),
        group="hidden layers",
        fixed=True),
 </s> add     "fc_depth": {
        "default": 1,
        "info": (
            "The number of consecutive Dense (fully connected) layers to include in each "
            "side's intermediate layer."),
        "datatype": int,
        "rounding": 1,
        "min_max": (0, 16),
        "group": "hidden layers",
        "fixed": True},
    "fc_min_filters": {
        "default": 1024,
        "info": (
            "The number of filters to use for the initial fully connected layer. The number of "
            "nodes actually used is: fc_min_filters x fc_dimensions x fc_dimensions.\nNB: This "
            "value may be scaled down, depending on output resolution."),
        "datatype": int,
        "rounding": 16,
        "min_max": (16, 5120),
        "group": "hidden layers",
        "fixed": True},
    "fc_max_filters": {
        "default": 1024,
        "info": (
            "This is the number of filters to be used in the final reshape layer at the end of "
            "the fully connected layers. The actual number of nodes used for the final fully "
            "connected layer is: fc_min_filters x fc_dimensions x fc_dimensions.\nNB: This value "
            "may be scaled down, depending on output resolution."),
        "datatype": int,
        "rounding": 64,
        "min_max": (128, 5120),
        "group": "hidden layers",
        "fixed": True},
    "fc_dimensions": {
        "default": 4,
        "info": (
            "The height and width dimension for the final reshape layer at the end of the "
            "fully connected layers.\nNB: The total number of nodes within the final fully "
            "connected layer will be: fc_dimensions x fc_dimensions x fc_max_filters."),
        "datatype": int,
        "rounding": 1,
        "min_max": (1, 16),
        "group": "hidden layers",
        "fixed": True},
    "fc_filter_slope": {
        "default": -0.5,
        "info": (
            "The rate that the filters move from the minimum number of filters to the maximum "
            "number of filters. EG:\n"
            "Negative numbers will change the number of filters quicker at first and slow down "
            "each layer.\n"
            "Positive numbers will change the number of filters slower at first but then speed "
            "up each layer.\n"
            "0.0 - This will change at a linear rate (i.e. the same number of filters will be "
            "changed at each layer)."),
        "datatype": float,
        "min_max": (-.99, .99),
        "rounding": 2,
        "group": "hidden layers",
        "fixed": True},
    "fc_dropout": {
        "default": 0.0,
        "info": (
            "Dropout is a form of regularization that can prevent a model from over-fitting "
            "and help to keep neurons 'alive'. 0.5 will dropout half the connections between each "
            "fully connected layer, 0.25 will dropout a quarter of the connections etc. Set to "
            "0.0 to disable."),
        "datatype": float,
        "rounding": 2,
        "min_max": (0.0, 0.99),
        "group": "hidden layers",
        "fixed": False},
    "fc_upsampler": {
        "default": "upsample2d",
        "info": (
            "The type of dimensional upsampling to perform at the end of the fully connected "
            "layers, if upsamples > 0. The number of filters used for the upscale layers will be "
            "the value given in 'fc_upsample_filters'."
            "\n\tupsample2d - A lightweight and VRAM friendly method. 'quick and dirty' but does "
            "not learn any parameters"
            "\n\tsubpixel - Sub-pixel upscaler using depth-to-space which may require more "
            "VRAM."
            "\n\tresize_images - Uses the Keras resize_image function to save about half as much "
            "vram as the heaviest methods."
            "\n\tupscale_fast - Developed by Andenixa. Focusses on speed to upscale, but "
            "requires more VRAM."
            "\n\tupscale_hybrid - Developed by Andenixa. Uses a combination of PixelShuffler and "
            "Upsampling2D to upscale, saving about 1/3rd of VRAM of the heaviest methods."),
        "datatype": str,
        "choices": ["resize_images", "subpixel", "upscale_fast", "upscale_hybrid", "upsample2d"],
        "group": "hidden layers",
        "gui_radio": False,
        "fixed": True},
    "fc_upsamples": {
        "default": 1,
        "info": (
            "Some upsampling can occur within the Fully Connected layers rather than in the "
            "Decoder to increase the dimensional space. Set how many upscale layers should occur "
            "within the Fully Connected layers."),
        "datatype": int,
        "min_max": (0, 4),
        "rounding": 1,
        "group": "hidden layers",
        "fixed": True},
    "fc_upsample_filters": {
        "default": 512,
        "info": (
            "If you have selected an upsampler which requires filters (i.e. any upsampler with "
            "the exception of Upsampling2D), then this is the number of filters to be used for "
            "the upsamplers within the fully connected layers,  NB: This value may be scaled "
            "down, depending on output resolution. Also note, that this figure will dictate the "
            "number of filters used for the G-Block, if selected."),
        "datatype": int,
        "rounding": 64,
        "min_max": (128, 5120),
        "group": "hidden layers",
        "fixed": True}, </s> remove         if get_backend() == "amd" and model.no_amd:
            valid = [k for k, v in _MODEL_MAPPING.items() if not v.no_amd]
            raise FaceswapError(f"'{arch}' is not compatible with the AMD backend. Choose one of "
                                f"{valid}.")

 </s> add 
                     "editing the plugin settings (GUI: Settings > Configure extract settings, "
                     "CLI: Edit the file faceswap/config/extract.ini)."
                     "\n3) Enable 'Single Process' mode.")
              raise FaceswapError(msg) from err

















  
      def finalize(self, batch: BatchType) -> Generator[ExtractMedia, None, None]:
          """ Finalize the output from Masker
  
          This should be called as the final task of each `plugin`.
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Remove plaidML support (#1325)

* Remove PlaidML reference from readme files

* Remove AMD option from installers

* remove amd requirements and update setup.py

* remove plaidml test from CI workflow

* gpustats: remove plaidml backend

* plaid removals:
  - faceswap.py - python version check
  - setup.cfg - plaidml typing ignore
  - lib.keras_utils - All plaid code
  - lib.launcher.py - All plaidml checks and configuration

* remove tf2.2 specific code from GUI event reader

* lib.model - remove all plaidml implementations

* plugins.extract - remove plaidml code

* plugins.train remove plaidml code

* lib.convert - remove plaidml code

* tools.model: remove plaidml code

* Remove plaidML tests from unit tests

* remove plaidml_utils and docsting cleanups

* Remove plaidML refs from configs

* fix keras imports 
plugins/extract/mask/_base.py