Install button for TensorRT - displayed only if an NVIDIA gpu is active

This commit is contained in:
cmdr2 2023-07-29 11:41:44 +05:30
parent a9960ded01
commit a9f1000af8
2 changed files with 43 additions and 5 deletions

View File

@ -360,6 +360,13 @@
<div class="parameters-table" id="system-settings-table"></div>
<br/>
<button id="save-system-settings-btn" class="primaryButton">Save</button>
<div id="install-extras-container" class="displayNone">
<br/>
<div id="install-extras">
<h3><i class="fa fa-bolt"></i> Accelerate Easy Diffusion</h3>
<div class="parameters-table" id="system-settings-install-extras-table"></div>
</div>
</div>
<br/><br/>
<div id="share-easy-diffusion">
<h3><i class="fa fa-user-group"></i> Share Easy Diffusion</h3>

View File

@ -16,6 +16,7 @@ var ParameterType = {
*/
let parametersTable = document.querySelector("#system-settings-table")
let networkParametersTable = document.querySelector("#system-settings-network-table")
let installExtrasTable = document.querySelector("#system-settings-install-extras-table")
/**
* JSDoc style
@ -241,6 +242,17 @@ var PARAMETERS = [
render: () => '<button id="toggle-cloudflare-tunnel" class="primaryButton">Start</button>',
table: networkParametersTable,
},
{
id: "nvidia_tensorrt",
type: ParameterType.custom,
label: "NVIDIA TensorRT",
note: `Faster image generation by converting your Stable Diffusion models to the NVIDIA TensorRT format. You can choose the
models to convert. Requires an NVIDIA graphics card.<br/><br/>
<b>Early access version:</b> support for LoRA is still under development.`,
icon: "fa-angles-up",
render: () => '<button id="install-tensorrt" class="primaryButton">Install</button>',
table: installExtrasTable,
},
]
function getParameterSettingsEntry(id) {
@ -582,6 +594,25 @@ function setDeviceInfo(devices) {
systemInfoEl.querySelector("#system-info-cpu").innerText = cpu
systemInfoEl.querySelector("#system-info-gpus-all").innerHTML = allGPUs.join("</br>")
systemInfoEl.querySelector("#system-info-rendering-devices").innerHTML = activeGPUs.join("</br>")
// tensorRT
if (devices.active) {
console.log(devices.active)
let nvidiaGPUs = Object.keys(devices.active).filter((d) => {
let gpuName = devices.active[d].name
gpuName = gpuName.toLowerCase()
console.log(gpuName)
return (
gpuName.includes("nvidia") ||
gpuName.includes("geforce") ||
gpuName.includes("quadro") ||
gpuName.includes("tesla")
)
})
if (nvidiaGPUs.length > 0) {
document.querySelector("#install-extras-container").classList.remove("displayNone")
}
}
}
function setHostInfo(hosts) {
@ -744,10 +775,10 @@ navigator.permissions.query({ name: "clipboard-write" }).then(function(result) {
document.addEventListener("system_info_update", (e) => setDeviceInfo(e.detail))
useBetaChannelField.addEventListener('change', (e) => {
if (e.target.checked) {
getParameterSettingsEntry("test_diffusers").classList.remove('displayNone')
} else {
getParameterSettingsEntry("test_diffusers").classList.add('displayNone')
useBetaChannelField.addEventListener("change", (e) => {
if (e.target.checked) {
getParameterSettingsEntry("test_diffusers").classList.remove("displayNone")
} else {
getParameterSettingsEntry("test_diffusers").classList.add("displayNone")
}
})