mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-22 00:03:20 +01:00
Merge pull request #1328 from ogmaresca/negative-lora-strength
Allow LoRA strengths between -2 and 2
This commit is contained in:
commit
f7c52b700e
@ -227,7 +227,7 @@
|
||||
</td></tr>
|
||||
<tr id="lora_alpha_container" class="pl-5">
|
||||
<td><label for="lora_alpha_slider">LoRA Strength:</label></td>
|
||||
<td> <input id="lora_alpha_slider" name="lora_alpha_slider" class="editor-slider" value="50" type="range" min="0" max="100"> <input id="lora_alpha" name="lora_alpha" size="4" pattern="^[0-9\.]+$" onkeypress="preventNonNumericalInput(event)"><br/></td>
|
||||
<td> <input id="lora_alpha_slider" name="lora_alpha_slider" class="editor-slider" value="50" type="range" min="-200" max="200"> <input id="lora_alpha" name="lora_alpha" size="4" pattern="^-?[0-9]*\.?[0-9]*$" onkeypress="preventNonNumericalInput(event)"><br/></td>
|
||||
</tr>
|
||||
<tr class="pl-5"><td><label for="hypernetwork_model">Hypernetwork:</label></td><td>
|
||||
<input id="hypernetwork_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
||||
|
@ -1725,10 +1725,10 @@ function updateLoraAlpha() {
|
||||
}
|
||||
|
||||
function updateLoraAlphaSlider() {
|
||||
if (loraAlphaField.value < 0) {
|
||||
loraAlphaField.value = 0
|
||||
} else if (loraAlphaField.value > 1) {
|
||||
loraAlphaField.value = 1
|
||||
if (loraAlphaField.value < -2) {
|
||||
loraAlphaField.value = -2
|
||||
} else if (loraAlphaField.value > 2) {
|
||||
loraAlphaField.value = 2
|
||||
}
|
||||
|
||||
loraAlphaSlider.value = loraAlphaField.value * 100
|
||||
|
@ -402,12 +402,12 @@ function debounce(func, wait, immediate) {
|
||||
|
||||
function preventNonNumericalInput(e) {
|
||||
e = e || window.event
|
||||
let charCode = typeof e.which == "undefined" ? e.keyCode : e.which
|
||||
let charStr = String.fromCharCode(charCode)
|
||||
let re = e.target.getAttribute("pattern") || "^[0-9]+$"
|
||||
re = new RegExp(re)
|
||||
const charCode = typeof e.which == "undefined" ? e.keyCode : e.which
|
||||
const charStr = String.fromCharCode(charCode)
|
||||
const newInputValue = `${e.target.value}${charStr}`
|
||||
const re = new RegExp(e.target.getAttribute("pattern") || "^[0-9]+$")
|
||||
|
||||
if (!charStr.match(re)) {
|
||||
if (!re.test(charStr) && !re.test(newInputValue)) {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user