feat: allow LoRAs with negative multiplier (#83)
* Allow Loras with negative weight, too. There are a couple of loras, which serve to adjust certain concepts in both positive and negative directions (like exposure, detail level etc). The current code rejects them if loaded with a negative weight, but I suggest that this check can simply be dropped. * ignore lora in the case of multiplier == 0.f --------- Co-authored-by: Urs Ganse <urs@nerd2nerd.org> Co-authored-by: leejet <leejet714@gmail.com>
This commit is contained in:
parent
51b53d4cb1
commit
ae1d5dcebb
@ -276,9 +276,11 @@ std::pair<std::unordered_map<std::string, float>, std::string> extract_and_remov
|
|||||||
while (std::regex_search(text, matches, re)) {
|
while (std::regex_search(text, matches, re)) {
|
||||||
std::string filename = matches[1].str();
|
std::string filename = matches[1].str();
|
||||||
float multiplier = std::stof(matches[2].str());
|
float multiplier = std::stof(matches[2].str());
|
||||||
if (multiplier < 0.f) {
|
|
||||||
|
if (multiplier == 0.f) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filename2multiplier.find(filename) == filename2multiplier.end()) {
|
if (filename2multiplier.find(filename) == filename2multiplier.end()) {
|
||||||
filename2multiplier[filename] = multiplier;
|
filename2multiplier[filename] = multiplier;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user