Skip to content

Commit 3c00786

Browse files
author
Kevin Turner
committed
chore: rename model.size to model.file_size
to disambiguate from RAM size or pixel size
1 parent bf63203 commit 3c00786

File tree

10 files changed

+83
-83
lines changed

10 files changed

+83
-83
lines changed

invokeai/app/api/routers/model_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def add_cover_image_to_model_config(config: AnyModelConfig, dependencies: Type[A
8585
"config_path": "string",
8686
"key": "string",
8787
"hash": "string",
88-
"size": 1,
88+
"file_size": 1,
8989
"description": "string",
9090
"source": "string",
9191
"converted_at": 0,

invokeai/app/services/model_records/model_records_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ModelRecordChanges(BaseModelExcludeNull):
8080
type: Optional[ModelType] = Field(description="Type of model", default=None)
8181
key: Optional[str] = Field(description="Database ID for this model", default=None)
8282
hash: Optional[str] = Field(description="hash of model file", default=None)
83-
size: Optional[int] = Field(description="Size of model file", default=None)
83+
file_size: Optional[int] = Field(description="Size of model file", default=None)
8484
format: Optional[str] = Field(description="format of model file", default=None)
8585
trigger_phrases: Optional[set[str]] = Field(description="Set of trigger phrases for this model", default=None)
8686
default_settings: Optional[MainModelDefaultSettings | ControlAdapterDefaultSettings] = Field(

invokeai/app/services/shared/sqlite_migrator/migrations/migration_19.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def __call__(self, cursor: sqlite3.Cursor) -> None:
1515

1616
def _add_size_column(self, cursor: sqlite3.Cursor) -> None:
1717
cursor.execute(
18-
"ALTER TABLE models ADD COLUMN size INTEGER "
19-
"GENERATED ALWAYS as (json_extract(config, '$.size')) VIRTUAL NOT NULL"
18+
"ALTER TABLE models ADD COLUMN file_size INTEGER "
19+
"GENERATED ALWAYS as (json_extract(config, '$.file_size')) VIRTUAL NOT NULL"
2020
)
2121

2222
def _populate_size(self, cursor: sqlite3.Cursor) -> None:
@@ -25,7 +25,7 @@ def _populate_size(self, cursor: sqlite3.Cursor) -> None:
2525
for model_id, model_path in all_models:
2626
mod = ModelOnDisk(self.models_path / model_path)
2727
cursor.execute(
28-
"UPDATE models SET config = json_set(config, '$.size', ?) WHERE id = ?", (mod.size(), model_id)
28+
"UPDATE models SET config = json_set(config, '$.file_size', ?) WHERE id = ?", (mod.size(), model_id)
2929
)
3030

3131

invokeai/backend/model_manager/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def json_schema_extra(schema: dict[str, Any]) -> None:
128128
path: str = Field(
129129
description="Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."
130130
)
131-
size: int = Field(description="The size of the model in bytes.")
131+
file_size: int = Field(description="The size of the model in bytes.")
132132
name: str = Field(description="Name of the model.")
133133
type: ModelType = Field(description="Model type")
134134
format: ModelFormat = Field(description="Model format")
@@ -242,7 +242,7 @@ def from_model_on_disk(cls, mod: ModelOnDisk, **overrides):
242242
fields["key"] = fields.get("key") or uuid_string()
243243
fields["description"] = fields.get("description") or f"{base.value} {type.value} model {name}"
244244
fields["repo_variant"] = fields.get("repo_variant") or mod.repo_variant()
245-
fields["size"] = fields.get("size") or mod.size()
245+
fields["file_size"] = fields.get("file_size") or mod.size()
246246

247247
return cls(**fields)
248248

invokeai/frontend/web/public/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@
767767
"deleteMsg2": "This WILL delete the model from disk if it is in the InvokeAI root folder. If you are using a custom location, then the model WILL NOT be deleted from disk.",
768768
"description": "Description",
769769
"edit": "Edit",
770+
"fileSize": "File Size",
770771
"fluxRedux": "FLUX Redux",
771772
"height": "Height",
772773
"huggingFace": "HuggingFace",
@@ -841,7 +842,6 @@
841842
"selectModel": "Select Model",
842843
"settings": "Settings",
843844
"simpleModelPlaceholder": "URL or path to a local file or diffusers folder",
844-
"size": "Size",
845845
"source": "Source",
846846
"sigLip": "SigLIP",
847847
"spandrelImageToImage": "Image to Image (Spandrel)",

invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelListItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const ModelListItem = ({ model }: ModelListItemProps) => {
109109
<ModelFormatBadge format={model.format} />
110110
</Flex>
111111
<Text>
112-
{(model.size / 1024 ** 3).toLocaleString(undefined, {
112+
{(model.file_size / 1024 ** 3).toLocaleString(undefined, {
113113
maximumFractionDigits: 2,
114114
style: 'unit',
115115
unit: 'gigabyte',

invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export const ModelView = memo(({ modelConfig }: Props) => {
5151
<ModelAttrView label={t('common.format')} value={modelConfig.format} />
5252
<ModelAttrView label={t('modelManager.path')} value={modelConfig.path} />
5353
<ModelAttrView
54-
label={t('modelManager.size')}
55-
value={(modelConfig.size / 1024 ** 3).toLocaleString(undefined, {
54+
label={t('modelManager.fileSize')}
55+
value={(modelConfig.file_size / 1024 ** 3).toLocaleString(undefined, {
5656
maximumFractionDigits: 2,
5757
style: 'unit',
5858
unit: 'gigabyte',

0 commit comments

Comments
 (0)