Implementation:AUTOMATIC1111 Stable diffusion webui System Info
| Knowledge Sources | |
|---|---|
| Domains | Diagnostics, System Information |
| Last Updated | 2025-05-15 00:00 GMT |
Overview
Collects and serializes comprehensive system diagnostic information including platform details, Python environment, GPU/CPU specs, installed packages, extensions, and application configuration into a checksummed JSON report.
Description
The sysinfo module gathers a wide range of system and application metadata for debugging and bug reporting purposes. The main entry point get() produces a JSON string containing platform info, Python version, git commit, torch environment, CPU and RAM details (via psutil), installed pip packages, active and inactive extensions, the current application config, startup timing data, and command-line arguments. Sensitive values like gradio_auth and api_auth are redacted from the command-line output via get_argv(). Environment variables are filtered through a whitelist to avoid leaking secrets.
The report includes a SHA-256 checksum embedded in the JSON itself. The check() function can verify report integrity by replacing the checksum with a token, re-hashing, and comparing. Helper functions include pretty_bytes() for human-readable byte formatting, get_cpu_info() and get_ram_info() for hardware details, get_torch_sysinfo() for PyTorch environment data, and get_extensions() for listing installed extensions with their git metadata.
Usage
Use this module to generate system information reports for debugging, to display in the web UI's system info tab, or to include in bug reports. The pretty_bytes() function is also used by other modules for human-readable file size formatting.
Code Reference
Source Location
- Repository: AUTOMATIC1111_Stable_diffusion_webui
- File: modules/sysinfo.py
- Lines: 1-215
Signature
def pretty_bytes(num, suffix="B") -> str
def get() -> str
def check(x: str) -> bool
def get_dict() -> dict
def get_cpu_info() -> dict
def get_ram_info() -> dict
def get_packages() -> list
def get_environment() -> dict
def get_argv() -> list
def get_torch_sysinfo() -> dict
def run_git(path, *args) -> str
def git_status(path) -> str
def get_info_from_repo_path(path: Path) -> dict
def get_extensions(*, enabled: bool, fallback_disabled_extensions=None) -> list
def get_config() -> dict
Import
from modules import sysinfo
# Or for specific utilities:
from modules.sysinfo import pretty_bytes, get, check
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| num | int or float | Yes | Byte count for pretty_bytes() formatting. |
| suffix | str | No | Suffix appended to formatted byte string; defaults to "B". |
| x | str | Yes | JSON string to verify integrity via check(). |
| enabled | bool | Yes | Whether to list enabled or disabled extensions in get_extensions(). |
| fallback_disabled_extensions | list | No | List of extension names considered disabled, used as fallback. |
Outputs
| Name | Type | Description |
|---|---|---|
| sysinfo_json | str | Full system information as a checksummed JSON string from get(). |
| is_valid | bool | Whether the checksum in the JSON report is valid from check(). |
| sysinfo_dict | dict | System information as a dictionary from get_dict(). |
| formatted_bytes | str | Human-readable byte string from pretty_bytes(). |
Usage Examples
from modules import sysinfo
# Generate a full system report
report = sysinfo.get()
print(report)
# Verify report integrity
is_valid = sysinfo.check(report)
print(f"Report valid: {is_valid}")
# Format a byte count
print(sysinfo.pretty_bytes(1073741824)) # "1GB"
# Get just the dictionary
info = sysinfo.get_dict()
print(f"Platform: {info['Platform']}")
print(f"Python: {info['Python']}")