mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
11 lines
564 B
Python
11 lines
564 B
Python
|
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:
|
||
|
print(f"* Warning: '{model_name}' is not a valid model name. Using default model instead.")
|
||
|
return model_manager.get_model()
|