plaidml_tools module

PlaidML tools.

Statistics and setup for PlaidML on AMD devices.

This module must be kept separate from Keras, and be called prior to any Keras import, as the plaidML Keras backend is set from this module.

class lib.plaidml_tools.PlaidMLStats(log_level='INFO', log=True)

Bases: object

Handles the initialization of PlaidML and the returning of GPU information for connected cards from the PlaidML library.

This class is initialized early in Faceswap’s Launch process from setup_plaidml(), with statistics made available from GPUStats

Parameters:
  • log_level (str, optional) – The requested Faceswap log level. Also dictates the level that PlaidML logging is set at. Default:”INFO”
  • log (bool, optional) – Whether this class should output to the logger. If statistics are being accessed during a crash, then the logger may not be available, so this gives the option to turn logging off in those kinds of situations. Default:True
active_devices

List of device indices for active GPU devices.

Type:list
device_count

The total number of GPU Devices discovered.

Type:int
devices

The pladml._DeviceConfig objects for GPUs that PlaidML has discovered.

Type:list
drivers

The driver versions for each GPU device that PlaidML has discovered.

Type:list
names

The name of each GPU device that PlaidML has discovered.

Type:list
vram

The VRAM of each GPU device that PlaidML has discovered.

Type:list
lib.plaidml_tools.setup_plaidml(log_level, exclude_devices)

Setup PlaidML for AMD Cards.

Sets the Keras backend to PlaidML, loads the plaidML backend and makes GPU Device information from PlaidML available to GPUStats.

Parameters:
  • log_level (str) – Faceswap’s log level. Used for setting the log level inside PlaidML
  • exclude_devices (list) – A list of integers of device IDs that should not be used by Faceswap