()
| 701 | } |
| 702 | |
| 703 | async function getSystemInfo() { |
| 704 | try { |
| 705 | const res = await SD.getSystemInfo() |
| 706 | let devices = res["devices"] |
| 707 | |
| 708 | let allDeviceIds = Object.keys(devices["all"]).filter((d) => d !== "cpu") |
| 709 | let activeDeviceIds = Object.keys(devices["active"]).filter((d) => d !== "cpu") |
| 710 | |
| 711 | if (activeDeviceIds.length === 0) { |
| 712 | useCPUField.checked = true |
| 713 | } |
| 714 | |
| 715 | if (allDeviceIds.length < MIN_GPUS_TO_SHOW_SELECTION || useCPUField.checked) { |
| 716 | let gpuSettingEntry = getParameterSettingsEntry("use_gpus") |
| 717 | gpuSettingEntry.style.display = "none" |
| 718 | let autoPickGPUSettingEntry = getParameterSettingsEntry("auto_pick_gpus") |
| 719 | autoPickGPUSettingEntry.style.display = "none" |
| 720 | } |
| 721 | |
| 722 | if (allDeviceIds.length === 0) { |
| 723 | useCPUField.checked = true |
| 724 | useCPUField.disabled = true // no compatible GPUs, so make the CPU mandatory |
| 725 | |
| 726 | getParameterSettingsEntry("use_cpu").addEventListener("click", function () { |
| 727 | alert( |
| 728 | "Sorry, we could not find a compatible graphics card! Easy Diffusion supports graphics cards with minimum 2 GB of RAM. " + |
| 729 | "Only NVIDIA cards are supported on Windows. NVIDIA and AMD cards are supported on Linux.<br/><br/>" + |
| 730 | "If you have a compatible graphics card, please try updating to the latest drivers.<br/><br/>" + |
| 731 | "Only the CPU can be used for generating images, without a compatible graphics card.", |
| 732 | "No compatible graphics card found!" |
| 733 | ) |
| 734 | }) |
| 735 | } |
| 736 | |
| 737 | autoPickGPUsField.checked = devices["config"] === "auto" |
| 738 | |
| 739 | useGPUsField.innerHTML = "" |
| 740 | allDeviceIds.forEach((device) => { |
| 741 | let deviceName = devices["all"][device]["name"] |
| 742 | let deviceOption = `<option value="${device}">${deviceName} (${device})</option>` |
| 743 | useGPUsField.insertAdjacentHTML("beforeend", deviceOption) |
| 744 | }) |
| 745 | |
| 746 | if (autoPickGPUsField.checked) { |
| 747 | let gpuSettingEntry = getParameterSettingsEntry("use_gpus") |
| 748 | gpuSettingEntry.style.display = "none" |
| 749 | } else { |
| 750 | $("#use_gpus").val(activeDeviceIds) |
| 751 | } |
| 752 | |
| 753 | document.dispatchEvent(new CustomEvent("system_info_update", { detail: devices })) |
| 754 | setHostInfo(res["hosts"]) |
| 755 | let force = false |
| 756 | if (res["enforce_output_dir"] !== undefined) { |
| 757 | force = res["enforce_output_dir"] |
| 758 | if (force == true) { |
| 759 | saveToDiskField.checked = true |
| 760 | metadataOutputFormatField.disabled = res["enforce_output_metadata"] |
no test coverage detected