From bbdeed3cf44d413eadb09a8f443b9d43ef0ce261 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 29 Sep 2024 20:45:27 -0700 Subject: [PATCH] Make sampler priority high if unspecified --- modules/sampler_hijack.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/sampler_hijack.py b/modules/sampler_hijack.py index 6d92978e..87f0b25e 100644 --- a/modules/sampler_hijack.py +++ b/modules/sampler_hijack.py @@ -602,11 +602,10 @@ def get_logits_processor_patch(self, **kwargs): def custom_sort_key(obj): class_name = obj.__class__.__name__ - # Return a large value if class name is not mapped or if the mapped nickname is not in priority + # Return -1 if class_name is not mapped if class_name not in class_name_to_nickname or class_name_to_nickname[class_name] not in sampler_priority: - return float('inf') + return -1 - # Return the index of the nickname in the priority list for sorting return sampler_priority.index(class_name_to_nickname[class_name]) # Sort the list using the custom key function