mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
13 lines
604 B
Python
13 lines
604 B
Python
import invokeai.backend.util.logging as log
|
|
from invokeai.app.invocations.baseinvocation import InvocationContext
|
|
from invokeai.backend.model_management.model_manager import ModelManager
|
|
|
|
|
|
def choose_model(model_manager: ModelManager, model_name: str):
|
|
"""Returns the default model if the `model_name` not a valid model, else returns the selected model."""
|
|
if model_manager.valid_model(model_name):
|
|
return model_manager.get_model(model_name)
|
|
else:
|
|
log.warning(f"'{model_name}' is not a valid model name. Using default model instead.")
|
|
return model_manager.get_model()
|