Skip to content

Commit

Permalink
Merge pull request #154 from Haidra-Org/main
Browse files Browse the repository at this point in the history
fix: lora orig name not searched in lowercase
  • Loading branch information
tazlin authored Jan 4, 2024
2 parents 386852a + 82b194d commit e4e0828
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hordelib/model_manager/lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ def fuzzy_find_lora_key(self, lora_name: int | str):
return None
if lora_name in self.model_reference:
return lora_name
if lora_name in self._index_orig_names:
return self._index_orig_names[lora_name]
if lora_name.lower() in self._index_orig_names:
return self._index_orig_names[lora_name.lower()]
if Sanitizer.has_unicode(lora_name):
for lora in self._index_orig_names:
if lora_name in lora:
Expand Down
19 changes: 19 additions & 0 deletions tests/model_managers/test_mm_lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ def test_fetch_adhoc_lora(self):
assert lora_model_manager.get_lora_filename("22591") == "GAG-RPGPotionsLoRaXL_197256.safetensors"
lora_model_manager.stop_all()

def test_fetch_adhoc_lora_conflicting_fuzz(self):
lora_model_manager = LoraModelManager(
download_wait=False,
allowed_adhoc_lora_storage=1024,
)
lora_model_manager.download_default_loras()
lora_model_manager.wait_for_downloads(600)
lora_model_manager.wait_for_adhoc_reset(15)

lora_model_manager.fetch_adhoc_lora("33970")
lora_model_manager.ensure_lora_deleted("Eula Genshin Impact | Character Lora 1644")
lora_model_manager.fetch_adhoc_lora("Eula Genshin Impact | Character Lora 1644")
assert lora_model_manager.get_lora_name("33970") == "Dehya Genshin Impact | Character Lora 809".lower()
assert (
lora_model_manager.get_lora_name("Eula Genshin Impact | Character Lora 1644")
== "Eula Genshin Impact | Character Lora 1644".lower()
)
lora_model_manager.stop_all()

def test_fetch_specific_lora_version(self):
lora_model_manager = LoraModelManager(
download_wait=False,
Expand Down

0 comments on commit e4e0828

Please sign in to comment.