MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / setDeviceInfo

Function setDeviceInfo

ui/media/js/parameters.js:655–695  ·  view source on GitHub ↗
(devices)

Source from the content-addressed store, hash-verified

653}
654
655function setDeviceInfo(devices) {
656 let cpu = devices.all.cpu.name
657 let allGPUs = Object.keys(devices.all).filter((d) => d != "cpu")
658 let activeGPUs = Object.keys(devices.active)
659
660 function ID_TO_TEXT(d) {
661 let info = devices.all[d]
662 if ("mem_free" in info && "mem_total" in info && info["mem_total"] > 0) {
663 return `${info.name} <small>(${d}) (${info.mem_free.toFixed(1)}Gb free / ${info.mem_total.toFixed(
664 1
665 )} Gb total)</small>`
666 } else {
667 return `${info.name} <small>(${d}) (no memory info)</small>`
668 }
669 }
670
671 allGPUs = allGPUs.map(ID_TO_TEXT)
672 activeGPUs = activeGPUs.map(ID_TO_TEXT)
673
674 let systemInfoEl = document.querySelector("#system-info")
675 systemInfoEl.querySelector("#system-info-cpu").innerText = cpu
676 systemInfoEl.querySelector("#system-info-gpus-all").innerHTML = allGPUs.join("</br>")
677 systemInfoEl.querySelector("#system-info-rendering-devices").innerHTML = activeGPUs.join("</br>")
678
679 // tensorRT
680 if (devices.active && testDiffusers.checked && devices.enable_trt === true) {
681 let nvidiaGPUs = Object.keys(devices.active).filter((d) => {
682 let gpuName = devices.active[d].name
683 gpuName = gpuName.toLowerCase()
684 return (
685 gpuName.includes("nvidia") ||
686 gpuName.includes("geforce") ||
687 gpuName.includes("quadro") ||
688 gpuName.includes("tesla")
689 )
690 })
691 if (nvidiaGPUs.length > 0) {
692 document.querySelector("#install-extras-container").classList.remove("displayNone")
693 }
694 }
695}
696
697function setHostInfo(hosts) {
698 let port = listenPortField.value

Callers 1

parameters.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected