lib.system package

The System Package handles collecting information about the running system

lib.system.ml_libs Module

Queries information about system installed Machine Learning Libraries. NOTE: Only packages from Python’s Standard Library should be imported in this module

lib.system.ml_libs.Cuda

alias of CudaLinux

class lib.system.ml_libs.CudaLinux

Find the location of system installed Cuda and cuDNN on Linux.

get_cudnn_versions() dict[tuple[int, int], tuple[int, int, int]]

Attempt to locate any installed cuDNN versions on Linux

Return type:

Detected cuDNN version for each installed Cuda. key (0, 0) denotes globally installed cudnn

get_version() tuple[int, int] | None

Attempt to locate the default Cuda version on Linux

Checks, in order: update-alternatives, /usr/local/cuda, ldconfig, nvcc

Return type:

The Default global Cuda version or None if not found

get_versions() dict[tuple[int, int], str]

Attempt to detect all installed Cuda versions on Linux systems

Return type:

The Cuda version to the folder path on Linux

class lib.system.ml_libs.CudaWindows

Find the location of system installed Cuda and cuDNN on Windows.

get_cudnn_versions() dict[tuple[int, int], tuple[int, int, int]]

Attempt to locate any installed cuDNN versions on Windows

Return type:

Detected cuDNN version for each installed Cuda. key (0, 0) denotes globally installed cudnn

get_version() tuple[int, int] | None

Attempt to get the default Cuda version from the Environment Variable

Return type:

The Default global Cuda version or None if not found

get_versions() dict[tuple[int, int], str]

Attempt to detect all installed Cuda versions on Windows systems from the registry

Return type:

The Cuda version to the folder path on Windows

class lib.system.ml_libs.ROCm

Find the location of system installed ROCm on Linux

property is_valid

True if the default ROCm version is valid

property valid_installed: bool

True if a valid version of ROCm is installed

property valid_versions: list[tuple[int, int, int]]

Valid ROCm versions

version: tuple[int, int, int]

Default ROCm installed version. (0, 0, 0) if not detected

versions: list[tuple[int, int, int]]

All detected ROCm installed versions

lib.system.ml_libs.get_cuda_finder() type[_Cuda]

Create a platform-specific CUDA object.

Return type:

The OS specific finder for system-wide Cuda

Functions

get_cuda_finder()

Create a platform-specific CUDA object.

Classes

Cuda

CudaLinux()

Find the location of system installed Cuda and cuDNN on Linux.

CudaWindows()

Find the location of system installed Cuda and cuDNN on Windows.

ROCm()

Find the location of system installed ROCm on Linux


lib.system.sysinfo Module

Obtain information about the running system, environment and GPU.

lib.system.sysinfo.get_sysinfo() str

Obtain extensive system information stats, formatted into a human readable format. If an error occurs obtaining the system information, then the error message is returned instead.

Returns:

  • The system information for the currently running system, formatted for output to console or a

  • log file.

Return type:

str

Functions

get_sysinfo()

Obtain extensive system information stats, formatted into a human readable format.


lib.system.system Module

Holds information about the running system. Used in setup.py and lib.sysinfo NOTE: Only packages from Python’s Standard Library should be imported in this module

class lib.system.system.Packages

Holds information about installed python and conda packages.

Note: Packaging library is lazy loaded as it may not be available during setup.py

property installed_conda: dict[str, tuple[str, str, str]]

Installed Conda package names to the version and channel

property installed_conda_pretty: str

A pretty printed representation of installed conda packages

property installed_python: dict[str, str]

Installed Python package names to Python package versions

property installed_python_pretty: str

A pretty printed representation of installed Python packages

class lib.system.system.System

Holds information about the currently running system and environment

cpu_count

The number of CPU cores on the system

encoding

The system encoding

is_admin

True if we are running with Admin privileges

is_conda

True if running under Conda otherwise False

property is_linux: bool

True if running on a Linux system otherwise False.

property is_macos: bool

True if running on a macOS system otherwise False.

is_virtual_env

True if Python is being run inside a virtual environment

property is_windows: bool

True if running on a Windows system otherwise False.

machine

“x86_64”)

Type:

The machine type (eg

platform

Human readable platform identifier

processor

The processor in use, if detected

python_architecture

64bit/32bit)

Type:

The Python architecture that is running (eg

python_implementation

The python implementation in use

python_version

The <major>.<minor>.<release> version of Python that is running

release

The OS Release that this code is running on

system: Literal['darwin', 'linux', 'windows']

The system (OS type) that this code is running on. Always lowercase

validate() None

Perform validation that the running system can be used for faceswap. Log an error and exit if it cannot

Return type:

None

validate_python(max_version: tuple[int, int] | None = None) bool

Check that the running Python version is valid

Parameters:

max_version (tuple[int, int] | None) – The max version to validate Python against. None for the project Maximum. Default: None (project maximum)

Return type:

True if the running Python version is valid, otherwise logs an error and exits

Classes

Packages()

Holds information about installed python and conda packages.

System()

Holds information about the currently running system and environment