lib.gpu_stats package
The GPU Stats Package handles collection of information from connected GPUs
lib.gpu_stats.apple_silicon Module
Collects and returns Information on available Apple Silicon SoCs in Apple Macs.
- class lib.gpu_stats.apple_silicon.AppleSiliconStats(log: bool = True)
Holds information and statistics about Apple Silicon SoC(s) available on the currently running Apple system.
Notes
Apple Silicon is a bit different from other backends, as it does not have a dedicated GPU with it’s own dedicated VRAM, rather the RAM is shared with the CPU and GPU. A combination of psutil and torch are used to pull as much useful information as possible.
- Parameters:
log (bool) – Whether the class should output information to the logger. There may be occasions where the logger has not yet been set up when this class is queried. Attempting to log in these instances will raise an error. If GPU stats are being queried prior to the logger being available then this parameter should be set to
False. Otherwise set toTrue. Default:True
- exclude_devices(devices: list[int]) None
Apple-Silicon does not support excluding devices
- Parameters:
devices (list[int]) – The GPU device IDS to be excluded
- Return type:
None
Classes
|
Holds information and statistics about Apple Silicon SoC(s) available on the currently running Apple system. |
Class Inheritance Diagram

lib.gpu_stats.cpu Module
Dummy functions for running faceswap on CPU.
- class lib.gpu_stats.cpu.CPUStats(log: bool = True)
Holds information and statistics about the CPU on the currently running system.
Notes
The information held here is not useful, but _GPUStats is dynamically imported depending on the backend used, so we need to make sure this class is available for Faceswap run on the CPU Backend.
The base
_GPUStatshandles the dummying in of information when no GPU is detected.- Parameters:
log (bool) – Whether the class should output information to the logger. There may be occasions where the logger has not yet been set up when this class is queried. Attempting to log in these instances will raise an error. If GPU stats are being queried prior to the logger being available then this parameter should be set to
False. Otherwise set toTrue. Default:True
- exclude_devices(devices: list[int]) None
CPU does not support excluding devices
- Parameters:
excluded (The GPU device IDS to be)
devices (list[int])
- Return type:
None
Classes
|
Holds information and statistics about the CPU on the currently running system. |
Class Inheritance Diagram

lib.gpu_stats.nvidia Module
Collects and returns Information on available Nvidia GPUs.
- class lib.gpu_stats.nvidia.NvidiaStats(log: bool = True)
Holds information and statistics about Nvidia GPU(s) available on the currently running system.
Notes
PyNVML is used for hooking in to Nvidia’s Machine Learning Library and allows for pulling fairly extensive statistics for Nvidia GPUs
- Parameters:
log (bool) – Whether the class should output information to the logger. There may be occasions where the logger has not yet been set up when this class is queried. Attempting to log in these instances will raise an error. If GPU stats are being queried prior to the logger being available then this parameter should be set to
False. Otherwise set toTrue. Default:True
- exclude_devices(devices: list[int]) None
Exclude GPU devices from being used by Faceswap. Sets the CUDA_VISIBLE_DEVICES environment variable. This must be called before Torch/Keras are imported
- Parameters:
excluded (The GPU device IDS to be)
devices (list[int])
- Return type:
None
Classes
|
Holds information and statistics about Nvidia GPU(s) available on the currently running system. |
Class Inheritance Diagram

lib.gpu_stats.rocm Module
Collects and returns Information about connected AMD GPUs for ROCm using sysfs and from modinfo
As no ROCm compatible hardware was available for testing, this just returns information on all AMD GPUs discovered on the system regardless of ROCm compatibility.
It is a good starting point but may need to be refined over time
- class lib.gpu_stats.rocm.ROCm(log: bool = True)
Holds information and statistics about GPUs connected using sysfs
- Parameters:
log (bool) – Whether the class should output information to the logger. There may be occasions where the logger has not yet been set up when this class is queried. Attempting to log in these instances will raise an error. If GPU stats are being queried prior to the logger being available then this parameter should be set to
False. Otherwise set toTrue. Default:True
- exclude_devices(devices: list[int]) None
Exclude GPU devices from being used by Faceswap. Sets the HIP_VISIBLE_DEVICES environment variable. This must be called before Torch/Keras are imported
- Parameters:
devices (list[int]) – The GPU device IDS to be excluded
- Return type:
None
Classes
|
Holds information and statistics about GPUs connected using sysfs |
Class Inheritance Diagram
