cddb07a176
docs / deploy (push) Has been cancelled
docs / changes (push) Has been cancelled
docs / check-and-build (push) Has been cancelled
build container image / cpu (push) Has been cancelled
build container image / cuda (push) Has been cancelled
build container image / rocm (push) Has been cancelled
frontend checks / frontend-checks (push) Has been cancelled
frontend tests / frontend-tests (push) Has been cancelled
lfs checks / lfs-check (push) Has been cancelled
python checks / python-checks (push) Has been cancelled
python tests / py3.12: macos-default (push) Has been cancelled
python tests / py3.11: windows-cpu (push) Has been cancelled
python tests / py3.12: windows-cpu (push) Has been cancelled
python tests / py3.11: linux-cpu (push) Has been cancelled
typegen checks / typegen-checks (push) Has been cancelled
uv lock checks / uv-lock-checks (push) Has been cancelled
openapi checks / openapi-checks (push) Has been cancelled
python tests / py3.11: macos-default (push) Has been cancelled
python tests / py3.12: linux-cpu (push) Has been cancelled
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
from typing import (
|
|
Literal,
|
|
Self,
|
|
)
|
|
|
|
from pydantic import Field
|
|
from typing_extensions import Any
|
|
|
|
from invokeai.backend.model_manager.configs.base import Config_Base, Diffusers_Config_Base
|
|
from invokeai.backend.model_manager.configs.identification_utils import (
|
|
common_config_paths,
|
|
raise_for_class_name,
|
|
raise_for_override_fields,
|
|
raise_if_not_dir,
|
|
)
|
|
from invokeai.backend.model_manager.model_on_disk import ModelOnDisk
|
|
from invokeai.backend.model_manager.taxonomy import (
|
|
BaseModelType,
|
|
ModelType,
|
|
)
|
|
|
|
|
|
class LlavaOnevision_Diffusers_Config(Diffusers_Config_Base, Config_Base):
|
|
"""Model config for Llava Onevision models."""
|
|
|
|
type: Literal[ModelType.LlavaOnevision] = Field(default=ModelType.LlavaOnevision)
|
|
base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)
|
|
cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")
|
|
|
|
@classmethod
|
|
def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
|
|
raise_if_not_dir(mod)
|
|
|
|
raise_for_override_fields(cls, override_fields)
|
|
|
|
raise_for_class_name(
|
|
common_config_paths(mod.path),
|
|
{
|
|
"LlavaOnevisionForConditionalGeneration",
|
|
},
|
|
)
|
|
|
|
return cls(**override_fields)
|