random model feature
multiple models to possibly load, choosing one at random
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Eric W. Burns
|
||||
Copyright (c) 2024-2025 Eric Burns
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
@@ -6,6 +6,7 @@ import gc
|
||||
import torch
|
||||
import requests
|
||||
import time
|
||||
import random
|
||||
|
||||
class EbuLMStudioLoadModel:
|
||||
ERROR_NO_MODEL_FOUND = "no model by that name found"
|
||||
@@ -94,6 +95,13 @@ class EbuLMStudioLoadModel:
|
||||
|
||||
def find_matching_model(self, search_term):
|
||||
try:
|
||||
# Check if multiple search strings are provided and select one at random
|
||||
if '|' in search_term:
|
||||
search_options = [s.strip() for s in search_term.split('|') if s.strip()]
|
||||
if search_options:
|
||||
search_term = random.choice(search_options)
|
||||
print(f"Multiple search strings provided. Randomly selected: '{search_term}'")
|
||||
|
||||
print("Fetching model list...")
|
||||
|
||||
# Run the 'lms ls --detailed' command to get available models
|
||||
|
||||
@@ -31,7 +31,7 @@ A collection of custom nodes for ComfyUI that provide integration with LM Studio
|
||||
Unloads any loaded LLMs and then loads an LLM model into LM Studio with the following parameters:
|
||||
|
||||
- `input_string`: Input text (passed through unchanged), serves to trigger the action
|
||||
- `model_search_string`: Part of the model name to search for (default: "llama"). Spaces are treated as wild cards. First matching LLM is loaded. So "nemo q5" will match "Mistral-Nemo-Instruct-2407-abliterated.Q5_K_M.gguf" for example.
|
||||
- `model_search_string`: Part of the model name to search for (default: "llama"). Spaces are treated as wild cards. First matching LLM is loaded. So "nemo q5" will match "Mistral-Nemo-Instruct-2407-abliterated.Q5_K_M.gguf" for example. You can have multiple searches separated by "|" and one will be chosen at random.
|
||||
- `context_length`: Model context length (default: 4096)
|
||||
- `seed`: Random seed to ensure that this runs on each request
|
||||
- `unload_image_models_first`: Whether to unload ComfyUI image models before loading LLM
|
||||
|
||||
Reference in New Issue
Block a user