Disable the GPU list if auto is enabled

This commit is contained in:
cmdr2 2022-11-14 13:02:36 +05:30
parent 027b2e1b88
commit f904945d40
3 changed files with 20 additions and 10 deletions

View File

@ -332,13 +332,13 @@
</div>
</body>
<script src="media/js/parameters.js?v=5"></script>
<script src="media/js/parameters.js?v=6"></script>
<script src="media/js/plugins.js?v=1"></script>
<script src="media/js/utils.js?v=6"></script>
<script src="media/js/inpainting-editor.js?v=1"></script>
<script src="media/js/image-modifiers.js?v=6"></script>
<script src="media/js/auto-save.js?v=7"></script>
<script src="media/js/main.js?v=14"></script>
<script src="media/js/main.js?v=15"></script>
<script src="media/js/themes.js?v=4"></script>
<script src="media/js/dnd.js?v=8"></script>
<script>

View File

@ -1147,7 +1147,13 @@ useCPUField.addEventListener('click', function() {
} else if (useGPUsField.options.length >= MIN_GPUS_TO_SHOW_SELECTION) {
gpuSettingEntry.style.display = ''
autoPickGPUSettingEntry.style.display = ''
autoPickGPUsField.checked = (autoPickGPUsField.getAttribute('data-old-value') === 'true')
let oldVal = autoPickGPUsField.getAttribute('data-old-value')
if (oldVal === null || oldVal === undefined) { // the UI started with CPU selected by default
autoPickGPUsField.checked = true
} else {
autoPickGPUsField.checked = (oldVal === 'true')
}
useGPUsField.disabled = autoPickGPUsField.checked
}
})
@ -1160,6 +1166,8 @@ autoPickGPUsField.addEventListener('click', function() {
if (this.checked) {
$('#use_gpus').val([])
}
useGPUsField.disabled = this.checked
})
async function changeAppConfig(configDelta) {
@ -1376,16 +1384,16 @@ async function getDevices() {
useCPUField.checked = true
}
if (allDeviceIds.length < MIN_GPUS_TO_SHOW_SELECTION) {
if (allDeviceIds.length < MIN_GPUS_TO_SHOW_SELECTION || useCPUField.checked) {
let gpuSettingEntry = getParameterSettingsEntry('use_gpus')
gpuSettingEntry.style.display = 'none'
let autoPickGPUSettingEntry = getParameterSettingsEntry('auto_pick_gpus')
autoPickGPUSettingEntry.style.display = 'none'
}
if (allDeviceIds.length === 0) {
useCPUField.checked = true
useCPUField.disabled = true // no compatible GPUs, so make the CPU mandatory
}
if (allDeviceIds.length === 0) {
useCPUField.checked = true
useCPUField.disabled = true // no compatible GPUs, so make the CPU mandatory
}
autoPickGPUsField.checked = (res['config'] === 'auto')
@ -1397,7 +1405,9 @@ async function getDevices() {
useGPUsField.insertAdjacentHTML('beforeend', deviceOption)
})
if (!autoPickGPUsField.checked) {
if (autoPickGPUsField.checked) {
useGPUsField.disabled = true
} else {
$('#use_gpus').val(activeDeviceIds)
}
}

View File

@ -83,7 +83,7 @@ var PARAMETERS = [
id: "use_gpus",
type: ParameterType.select_multiple,
label: "GPUs to use",
note: "select multiple GPUs to process in parallel",
note: "to process in parallel",
default: false,
},
{