mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(mm): add helper method for legacy configs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from invokeai.backend.model_manager.configs.factory import AnyModelConfig
|
||||
from invokeai.backend.model_manager.taxonomy import (
|
||||
BaseModelType,
|
||||
ModelType,
|
||||
@@ -15,6 +16,12 @@ class LegacyConfigKey:
|
||||
variant: ModelVariantType | None = None
|
||||
pred: SchedulerPredictionType | None = None
|
||||
|
||||
@classmethod
|
||||
def from_model_config(cls, config: AnyModelConfig) -> "LegacyConfigKey":
|
||||
variant = getattr(config, "variant", None)
|
||||
pred = getattr(config, "prediction_type", None)
|
||||
return cls(type=config.type, base=config.base, variant=variant, pred=pred)
|
||||
|
||||
|
||||
LEGACY_CONFIG_MAP: dict[LegacyConfigKey, str] = {
|
||||
LegacyConfigKey(
|
||||
|
||||
Reference in New Issue
Block a user