Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(models): enable FP8 storage for FP8 checkpoints at install
Alexander Eichhorn6706a708c1f5
diff --git a/docs/src/content/docs/configuration/fp8-storage.mdx b/docs/src/content/docs/configuration/fp8-storage.mdxindex 89d4db6399..6523e6c241 100644--- a/docs/src/content/docs/configuration/fp8-storage.mdx+++ b/docs/src/content/docs/configuration/fp8-storage.mdx@@ -11,7 +11,7 @@ FP8 Storage cuts a model's VRAM footprint roughly in half by keeping weights onIt pairs well with [Low-VRAM mode](/configuration/low-vram-mode/): low-VRAM mode streams layers between RAM and VRAM, while FP8 Storage shrinks the layers themselves.:::caution[For full precision models only]-FP8 Storage only applies to **full precision** checkpoints (FP16 / BF16 / FP32). It is **silently a no-op** for already-quantized formats — **GGUF**, **NF4**, **int8**, and [**SDNQ**](/configuration/sdnq-quantization/) checkpoints carry their own storage precision and the loader returns a different module type that the FP8 layer cast does not touch. If your model is already quantized, the toggle has no effect; use the full-precision variant of the model if you want to enable FP8 Storage.+FP8 Storage only applies to **full precision** checkpoints (FP16 / BF16 / FP32). It is **silently a no-op** for already-quantized formats — **GGUF**, **NF4**, **int8**, and [**SDNQ**](/configuration/sdnq-quantization/) checkpoints carry their own storage precision and the loader returns a different module type that the FP8 layer cast does not touch. If your model is already quantized, the toggle has no effect; use the full-precision variant of the model if you want to enable FP8 Storage. Checkpoints that store FP8 weights are the exception: InvokeAI loads them at BF16 unless FP8 Storage is on, so they get it automatically when installed (see [When installing](#when-installing)).:::## Requirements@@ -54,6 +54,13 @@ FP8 Storage is a **per-model setting**, configured from the Model Manager:The setting takes effect on the next load. If the model is already in the cache, InvokeAI evicts the cached copy automatically so the new setting applies — even if a generation is currently using the model (the eviction is deferred until the generation finishes).+### When installing++- **Checkpoints that already store FP8 weights get FP8 Storage automatically.** InvokeAI reads the weight types from the file while identifying the model, not its name, so a renamed `fp8_scaled` file is recognised and a full-precision file with "fp8" in its name is not. Only the denoiser counts: an all-in-one checkpoint with an FP8 text encoder beside a full-precision UNet or transformer is left alone. Without this, an FP8 checkpoint would be loaded at BF16 and take twice the VRAM.+- **For any other model, tick FP8 storage next to the install source** (a file path, URL or HuggingFace repo, and in folder scan results). It applies to the models you install from there.++Either way the setting stays editable under **Default Settings** afterwards. Re-identifying a model resets its default settings, including this one, to what identification chooses.+:::tip[When to enable]Enable FP8 Storage on large models that don't fit comfortably in VRAM — FLUX dev/Klein, large SDXL checkpoints, ControlNet-XL adapters. For smaller SD1 / SD2 models, the savings are negligible and not worth the small precision trade-off.:::@@ -115,7 +122,7 @@ If you see unexpected quality regressions, disable FP8 Storage on the affected mEverything above describes FP8 *Storage*, which changes how weights are **stored** while the math still runs in BF16. `fp8_compute` is a separate, global setting in `invokeai.yaml` that also does the **math** in FP8, on GPUs that have hardware for it. That makes generation faster, not just smaller.-It is for models that were **already saved in FP8** by whoever published them — you'll often see these labelled "fp8" or "fp8_scaled" in the filename. Normally InvokeAI unpacks them back to BF16 while loading; with `fp8_compute` on, they stay as they are and run directly on the GPU's FP8 hardware. FP8 Storage is the toggle for the other case: a full-precision model you want to shrink yourself.+It is for models that were **already saved in FP8** by whoever published them — you'll often see these labelled "fp8" or "fp8_scaled" in the filename. Without it InvokeAI unpacks them to BF16 while loading, and FP8 Storage — which they get automatically when installed — keeps them FP8 in VRAM; with `fp8_compute` on, they stay as they are and run directly on the GPU's FP8 hardware, and FP8 Storage has nothing left to do for those layers.Not every part of a model stays in FP8 — the small, precision-sensitive pieces are always unpacked. Those are a tiny share of the weights, so you still get nearly the full VRAM saving.diff --git a/invokeai/backend/model_manager/configs/factory.py b/invokeai/backend/model_manager/configs/factory.pyindex 677b86bdc5..a09aac8ac6 100644--- a/invokeai/backend/model_manager/configs/factory.py+++ b/invokeai/backend/model_manager/configs/factory.py@@ -3,10 +3,11 @@ import loggingfrom dataclasses import dataclassfrom pathlib import Pathfrom typing import (+ TypeVar,Union,)-from pydantic import Discriminator, TypeAdapter, ValidationError+from pydantic import BaseModel, Discriminator, TypeAdapter, ValidationErrorfrom typing_extensions import Annotated, Anyfrom invokeai.app.services.config.config_default import get_config@@ -29,6 +30,7 @@ from invokeai.backend.model_manager.configs.controlnet import (ControlNet_Diffusers_SD2_Config,ControlNet_Diffusers_SDXL_Config,)+from invokeai.backend.model_manager.configs.default_settings import MainModelDefaultSettingsfrom invokeai.backend.model_manager.configs.external_api import ExternalApiModelConfigfrom invokeai.backend.model_manager.configs.flux_redux import FLUXRedux_Checkpoint_Configfrom invokeai.backend.model_manager.configs.gemma2_encoder import (@@ -176,8 +178,9 @@ from invokeai.backend.model_manager.configs.vae import (VAE_Diffusers_Wan_Config,)from invokeai.backend.model_manager.configs.wan_t5_encoder import WanT5Encoder_WanT5Encoder_Config-from invokeai.backend.model_manager.model_on_disk import ModelOnDisk+from invokeai.backend.model_manager.model_on_disk import ModelOnDisk, read_safetensors_headerfrom invokeai.backend.model_manager.taxonomy import (+ QUANTIZED_MODEL_FORMATS,BaseModelType,ModelFormat,ModelSourceType,@@ -186,6 +189,79 @@ from invokeai.backend.model_manager.taxonomy import ()logger = logging.getLogger(__name__)++_FP8_SAFETENSORS_DTYPES = frozenset({"F8_E4M3", "F8_E5M2"})++# What single-file checkpoints bundle beside their denoiser. Float8 weights there say nothing about the denoiser.+_BUNDLED_COMPONENT_KEY_PREFIXES = ("cond_stage_model.", "conditioner.", "first_stage_model.", "text_encoders.", "vae.")++# Where a diffusers folder keeps its denoiser. A single-component folder (a ControlNet) keeps it at the root.+_DENOISER_SUBFOLDERS = frozenset({"transformer", "unet"})++SettingsT = TypeVar("SettingsT", bound=BaseModel)+++def _denoiser_stores_float8_weights(mod: ModelOnDisk) -> bool:+ """Whether the model's denoiser weights are stored in float8, judged by the safetensors headers' dtypes and never+ by a file name.++ Only headers are read, a few KB each. A header that cannot be read is no evidence of float8 weights: identification+ did not need that file, and picking a default setting is no reason to fail an install.+ """+ if mod.path.is_file():+ candidates = [mod.path]+ else:+ candidates = [+ path+ for path in mod.weight_files()+ if path.parent == mod.path or path.relative_to(mod.path).parts[0] in _DENOISER_SUBFOLDERS+ ]++ for path in candidates:+ if path.suffix != ".safetensors":+ continue+ try:+ header = read_safetensors_header(path)+ except (OSError, ValueError) as e:+ logger.debug(f"Could not read the safetensors header of {path} to look for float8 weights: {e}")+ continue+ if any(+ not key.startswith(_BUNDLED_COMPONENT_KEY_PREFIXES)+ and isinstance(info, dict)+ and info.get("dtype") in _FP8_SAFETENSORS_DTYPES+ for key, info in header.items()+ ):+ return True+ return False+++def _identified_default_settings(+ recommended: SettingsT | None,+ settings_cls: type[SettingsT],+ mod: ModelOnDisk,+ override_fields: dict[str, Any] | None,+ fp8_storage_applies: bool,+) -> SettingsT | None:+ """Layer the settings sent with an install, and FP8 Storage for a float8 denoiser, over the recommended defaults.++ An install setting wins over detection in both directions. Fields the settings class does not have (a main-model+ field sent along with a LoRA install) are dropped, since nothing would read them.+ """+ requested = (override_fields or {}).get("default_settings") or {}+ update = {+ name: value for name, value in requested.items() if name in settings_cls.model_fields and value is not None+ }++ if fp8_storage_applies and "fp8_storage" not in update and _denoiser_stores_float8_weights(mod):+ logger.info(f"{mod.name}: denoiser weights are stored in float8, enabling FP8 Storage by default")+ update["fp8_storage"] = True++ if not update:+ return recommended+ current = recommended.model_dump() if recommended is not None else {}+ return settings_cls.model_validate({**current, **update})++app_config = get_config()# Known model file extensions for sanity checking@@ -785,11 +861,30 @@ class ModelConfigFactory:# so its name is the only signal. What each architecture recommends lives in# invokeai/backend/architectures/defs/.variant = getattr(config, "variant", None)- config.default_settings = resolve_default_settings(config.base, variant, config.name, config.path)+ config.default_settings = _identified_default_settings(+ resolve_default_settings(config.base, variant, config.name, config.path),+ MainModelDefaultSettings,+ mod,+ override_fields,+ fp8_storage_applies=config.format not in QUANTIZED_MODEL_FORMATS,+ )case ModelType.ControlNet | ModelType.T2IAdapter | ModelType.ControlLoRa:- config.default_settings = ControlAdapterDefaultSettings.from_model_name(config.name)+ config.default_settings = _identified_default_settings(+ ControlAdapterDefaultSettings.from_model_name(config.name),+ ControlAdapterDefaultSettings,+ mod,+ override_fields,+ # A ControlLoRA is patched into its base model and never cast on its own.+ fp8_storage_applies=config.type is not ModelType.ControlLoRa,+ )case ModelType.LoRA:- config.default_settings = LoraModelDefaultSettings()+ config.default_settings = _identified_default_settings(+ LoraModelDefaultSettings(),+ LoraModelDefaultSettings,+ mod,+ override_fields,+ fp8_storage_applies=False,+ )case _:passdiff --git a/invokeai/backend/model_manager/load/load_default.py b/invokeai/backend/model_manager/load/load_default.pyindex 276c67726d..d98d9a7c66 100644--- a/invokeai/backend/model_manager/load/load_default.py+++ b/invokeai/backend/model_manager/load/load_default.py@@ -25,6 +25,7 @@ from invokeai.backend.model_manager.load.model_cache.model_cache import (from invokeai.backend.model_manager.load.model_util import calc_model_size_by_fsfrom invokeai.backend.model_manager.load.optimizations import skip_torch_weight_initfrom invokeai.backend.model_manager.taxonomy import (+ QUANTIZED_MODEL_FORMATS,AnyModel,SubModelType,)@@ -158,21 +159,6 @@ _FP8_DEFAULT_SKIP_PATTERNS: tuple[str, ...] = (r"^proj_out$",)-# Model formats whose weights are already quantized. FP8 storage is meaningless for them (the-# payload is packed integers, not values we may re-encode) and actively harmful — see-# `_should_use_fp8`. Declared as strings to keep this module free of a taxonomy import at module-# scope; compared against `config.format`, which is a `ModelFormat` str-enum. Must list every-# quantized member of `ModelFormat`; `test_quantized_format_set_matches_the_taxonomy` pins the-# strings to the enum so a rename cannot silently disable the check.-_QUANTIZED_MODEL_FORMATS: frozenset[str] = frozenset(- {- "gguf_quantized",- "bnb_quantized_nf4b",- "bnb_quantized_int8b",- "sdnq_quantized",- }-)-def _is_quantized_param(param: torch.nn.Parameter) -> bool:"""Whether `param` holds a quantized payload that must not be re-encoded as FP8.@@ -438,7 +424,8 @@ class ModelLoader(ModelLoaderBase):# No quantized-format loader calls `_apply_fp8_layerwise_casting` today, so this is a guard# against the next loader that gets wired up (they are being added one model at a time)# rather than a fix for a live crash.- if hasattr(config, "format") and config.format in _QUANTIZED_MODEL_FORMATS:+ # The payload is packed integers, not values FP8 storage may re-encode.+ if hasattr(config, "format") and config.format in QUANTIZED_MODEL_FORMATS:return False# VAEs are excluded — fp8 storage causes noticeable quality degradation in decode.diff --git a/invokeai/backend/model_manager/model_on_disk.py b/invokeai/backend/model_manager/model_on_disk.pyindex f8b9798061..6087a195ad 100644--- a/invokeai/backend/model_manager/model_on_disk.py+++ b/invokeai/backend/model_manager/model_on_disk.py@@ -1,4 +1,5 @@import json+import osfrom pathlib import Pathfrom typing import Any, Optional, TypeAlias@@ -41,6 +42,27 @@ SAFETENSORS_DTYPES: dict[str, torch.dtype] = {"""safetensors dtype names mapped to their torch equivalents."""+def read_safetensors_header(path: Path) -> dict[str, Any]:+ """Read a safetensors file's JSON header: dtype, shape and data offsets per tensor key, without `__metadata__`.++ Raises:+ OSError: The file could not be read.+ ValueError: The header is not valid JSON (an empty or truncated file, or not safetensors at all).+ """+ with open(path, "rb") as f:+ header_length = int.from_bytes(f.read(8), "little")+ # Any 8 bytes decode to a length; for a file that is not safetensors that length is garbage, and reading it+ # would try to allocate it.+ if header_length > os.fstat(f.fileno()).st_size - 8:+ raise ValueError(f"{path} is not a safetensors file: its header length exceeds the file size")+ header = json.loads(f.read(header_length))++ if not isinstance(header, dict):+ raise ValueError(f"{path} is not a safetensors file: its header is not a JSON object")+ header.pop("__metadata__", None)+ return header++def _safetensors_meta_state_dict(path: Path) -> StateDict:"""Build a state dict of `meta` tensors from a safetensors file's header.@@ -52,11 +74,7 @@ def _safetensors_meta_state_dict(path: Path) -> StateDict:Exception: The header could not be parsed, or names a dtype with no torch equivalent. Callers shouldfall back to loading the file for real."""- with open(path, "rb") as f:- header_length = int.from_bytes(f.read(8), "little")- header = json.loads(f.read(header_length))-- header.pop("__metadata__", None)+ header = read_safetensors_header(path)return {key: torch.empty(info["shape"], dtype=SAFETENSORS_DTYPES[info["dtype"]], device="meta")for key, info in header.items()diff --git a/invokeai/backend/model_manager/taxonomy.py b/invokeai/backend/model_manager/taxonomy.pyindex 22ce899c86..b46e5195a0 100644--- a/invokeai/backend/model_manager/taxonomy.py+++ b/invokeai/backend/model_manager/taxonomy.py@@ -334,6 +334,17 @@ class ModelFormat(str, Enum):Unknown = "unknown"+QUANTIZED_MODEL_FORMATS: frozenset[ModelFormat] = frozenset(+ {+ ModelFormat.GGUFQuantized,+ ModelFormat.BnbQuantizednf4b,+ ModelFormat.BnbQuantizedLlmInt8b,+ ModelFormat.SDNQQuantized,+ }+)+"""Formats whose weights are already quantized: packed payloads FP8 Storage must never re-encode."""++class SchedulerPredictionType(str, Enum):"""Scheduler prediction type."""diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsxindex 7f8c7de862..1fc36265a3 100644--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx@@ -58,7 +58,7 @@ export const MainModelDefaultSettings = memo(({ modelConfig }: Props) => {// Already-quantized weights cannot also be stored as FP8 — the backend refuses it (see// `_should_use_fp8`), so offering the switch would be a control that silently does nothing.- // Keep in sync with `_QUANTIZED_MODEL_FORMATS` in `load_default.py`.+ // Keep in sync with `QUANTIZED_MODEL_FORMATS` in `taxonomy.py`.const isQuantized = useMemo(() => {return ['gguf_quantized', 'bnb_quantized_nf4b', 'bnb_quantized_int8b', 'sdnq_quantized'].includes(modelConfig.formatdiff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex ef6de715b1..818bf69b46 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -1177,6 +1177,8 @@"installAllQueuedDescription_other": "{{count}} installs queued.","installBundle": "Install bundle","installFailed": "Install failed",+ "installFp8Storage": "FP8 storage",+ "installFp8StorageTooltip": "Store the weights in FP8 to roughly halve VRAM use. Checkpoints that already store FP8 weights get this automatically; GGUF, NF4 and SDNQ models are not affected.","installInPlace": "Install in place","installJobSummary_one": "{{count}} job · no active installs","installJobSummary_other": "{{count}} jobs · no active installs",diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.browser.test.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.browser.test.tsxindex 4bd95bbb1b..6e0d4b5498 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.browser.test.tsx@@ -7,6 +7,7 @@ import { system } from '@theme/system';import { act, StrictMode } from 'react';import { createRoot, type Root } from 'react-dom/client';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { userEvent } from 'vitest/browser';import { AddModelsView } from './AddModelsView';@@ -63,8 +64,10 @@ vi.mock('@features/models/data/api', async (importOriginal) => ({scanFolderForModels: vi.fn(),}));+const installActions = vi.hoisted(() => ({ install: vi.fn(), installMany: vi.fn() }));+vi.mock('./useInstallActions', () => ({- useInstallActions: () => ({ install: vi.fn(), installMany: vi.fn(), pendingSources: new Set() }),+ useInstallActions: () => ({ ...installActions, pendingSources: new Set() }),}));vi.mock('@features/models/ui/useModelsNotify', () => ({@@ -143,6 +146,81 @@ describe('AddModelsView search seed', () => {await unmount();});+ it('sends FP8 storage with a pulled file only while it is ticked', async () => {+ installActions.install.mockReset();+ await mount();++ const source = '/models/qwen_image.safetensors';+ const pull = () => [...document.querySelectorAll('button')].find((button) => button.textContent === 'models.pull');++ await act(() => userEvent.fill(searchBox()!, source));+ await act(() => userEvent.click(pull()!));++ // Unticked sends nothing, so identification can still turn FP8 storage on for an FP8 checkpoint.+ expect(installActions.install).toHaveBeenLastCalledWith(+ expect.objectContaining({ config: undefined, inplace: true, source })+ );++ const fp8Storage = [...document.querySelectorAll('label')].find(+ (label) => label.textContent === 'models.installFp8Storage'+ );+ await act(() => userEvent.click(fp8Storage!));+ await act(() => userEvent.click(pull()!));++ expect(installActions.install).toHaveBeenLastCalledWith(+ expect.objectContaining({ config: { default_settings: { fp8_storage: true } }, inplace: true, source })+ );++ await unmount();+ });++ it.each([+ [+ 'folder scan results',+ () =>+ updateModelsUi({+ scan: { path: '/models', results: [{ is_installed: false, path: '/models/qwen_image.safetensors' }] },+ }),+ ],+ [+ 'a Hugging Face file list',+ () =>+ updateModelsUi({+ hfLookup: {+ repo: 'owner/repo',+ urls: [+ 'https://huggingface.co/owner/repo/resolve/main/a.safetensors',+ 'https://huggingface.co/owner/repo/resolve/main/b.safetensors',+ ],+ },+ }),+ ],+ ])('sends FP8 storage with every install from %s once it is ticked there', async (_source, openResults) => {+ installActions.installMany.mockReset();+ setModelsSnapshotForTests({ models: [], status: 'loaded' });+ await mount();+ await act(() => openResults());++ // The results replace the hint row, so the option has to be on the results panel itself.+ const fp8Storage = [...document.querySelectorAll('label')].find(+ (label) => label.textContent === 'models.installFp8Storage'+ );+ await act(() => userEvent.click(fp8Storage!));+ const installAll = [...document.querySelectorAll('button')].find(+ (button) => button.textContent === 'models.installAllCount'+ );+ await act(() => userEvent.click(installAll!));++ const [requests] = installActions.installMany.mock.lastCall as [{ config?: unknown }[]];+ expect(requests.length).toBeGreaterThan(0);+ for (const request of requests) {+ expect(request.config).toEqual({ default_settings: { fp8_storage: true } });+ }++ await act(() => updateModelsUi({ hfLookup: null, scan: null }));+ await unmount();+ });+it('links each installed starter to the library model it became', async () => {setModelsSnapshotForTests({models: [diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsxindex b8353d8df4..c0d73f0ba0 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx@@ -1,8 +1,8 @@/* eslint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */-import type { StarterModel } from '@features/models/core/types';+import type { ModelRecordChanges, StarterModel } from '@features/models/core/types';import type { ElementType } from 'react';-import { Box, Checkbox, Flex, HStack, Icon, Input, InputGroup, Stack, Text } from '@chakra-ui/react';+import { Box, Flex, HStack, Icon, Input, InputGroup, Stack, Text } from '@chakra-ui/react';import { collectBases, collectTypes } from '@features/models/core/library';import {DEFAULT_STARTER_MODEL_FILTERS,@@ -42,6 +42,7 @@ import { useTranslation } from 'react-i18next';import { AccessTokenPopover } from './AccessTokenPopover';import { BundleChips } from './BundleChips';import { HuggingFaceFiles } from './HuggingFaceFiles';+import { InstallOptions } from './InstallOptions';import { ScanResults } from './ScanResults';import { SelectedBundleBar } from './SelectedBundleBar';import { classifySource } from './sourceClassifier';@@ -58,6 +59,12 @@ const SOURCE_KIND_ICONS: Record<string, ElementType> = {'models.sourceKind.url': LinkIcon,};+/**+ * Sent only when ticked. Identification turns FP8 storage on for checkpoints that already store FP8 weights, and an+ * explicit `false` would override that.+ */+const FP8_STORAGE_INSTALL_CONFIG: ModelRecordChanges = { default_settings: { fp8_storage: true } };+/*** One box to add any model. The same field searches the curated starter* catalog and accepts a URL, local path, or HuggingFace repo to install@@ -90,6 +97,7 @@ export const AddModelsView = () => {const [query, setQuery] = useState(getAddModelsSeed);const [accessToken, setAccessToken] = useState('');const [inplace, setInplace] = useState(true);+ const [fp8Storage, setFp8Storage] = useState(false);const { isBusy: isPulling, run: runPull } = useScopedAction();const { isBusy: isScanning, run: runScan } = useScopedAction();const [installingBundle, setInstallingBundle] = useState<string | null>(null);@@ -136,6 +144,7 @@ export const AddModelsView = () => {const kind = useMemo(() => classifySource(trimmed), [trimmed]);const searchIcon = (kind.labelKey ? SOURCE_KIND_ICONS[kind.labelKey] : undefined) ?? SearchIcon;const token = accessToken.trim() === '' ? undefined : accessToken.trim();+ const installConfig = fp8Storage ? FP8_STORAGE_INSTALL_CONFIG : undefined;// The primary action depends on the detected input: folders are scanned for// models; files, URLs, and HF repos are pulled. Access tokens only apply to URLs.const canScan = kind.localKind === 'folder';@@ -228,7 +237,10 @@ export const AddModelsView = () => {if (lookup.is_diffusers) {updateModelsUi({ hfLookup: null });- if ((await install({ accessToken: token, source: trimmed })) && isAccountScopeCurrent(owner)) {+ if (+ (await install({ accessToken: token, config: installConfig, source: trimmed })) &&+ isAccountScopeCurrent(owner)+ ) {setQuery('');}@@ -248,7 +260,10 @@ export const AddModelsView = () => {if (lookup.urls.length === 1 && onlyUrl) {updateModelsUi({ hfLookup: null });- if ((await install({ accessToken: token, source: onlyUrl })) && isAccountScopeCurrent(owner)) {+ if (+ (await install({ accessToken: token, config: installConfig, source: onlyUrl })) &&+ isAccountScopeCurrent(owner)+ ) {setQuery('');}@@ -261,7 +276,12 @@ export const AddModelsView = () => {}if (- (await install({ accessToken: token, inplace: kind.looksLocal ? inplace : undefined, source: trimmed })) &&+ (await install({+ accessToken: token,+ config: installConfig,+ inplace: kind.looksLocal ? inplace : undefined,+ source: trimmed,+ })) &&isAccountScopeCurrent(owner)) {setQuery('');@@ -354,17 +374,13 @@ export const AddModelsView = () => {{t('models.toInstallFrom', { source: t(kind.labelKey) })}</Text>)}- {kind.localKind === 'file' ? (- <Checkbox.Root- checked={inplace}- colorPalette="accent"- size="xs"- onCheckedChange={(event) => setInplace(event.checked === true)}- >- <Checkbox.HiddenInput />- <Checkbox.Control />- <Checkbox.Label fontSize="2xs">{t('models.installInPlace')}</Checkbox.Label>- </Checkbox.Root>+ {canPull ? (+ <InstallOptions+ fp8Storage={fp8Storage}+ inplace={kind.localKind === 'file' ? inplace : undefined}+ onSetFp8Storage={setFp8Storage}+ onSetInplace={setInplace}+ />) : null}</HStack>) : null}@@ -404,24 +420,32 @@ export const AddModelsView = () => {<Stack gap="3">{hfLookup ? (<HuggingFaceFiles+ fp8Storage={fp8Storage}lookup={hfLookup}pendingSources={pendingSources}onClear={() => updateModelsUi({ hfLookup: null })}- onInstall={(url) => void install({ accessToken: token, source: url })}+ onInstall={(url) => void install({ accessToken: token, config: installConfig, source: url })}onInstallAll={(urls) =>- void installAllSources(urls.map((url) => ({ accessToken: token, source: url })))+ void installAllSources(+ urls.map((url) => ({ accessToken: token, config: installConfig, source: url }))+ )}+ onSetFp8Storage={setFp8Storage}/>) : null}{scan ? (<ScanResults+ fp8Storage={fp8Storage}inplace={inplace}pendingSources={pendingSources}scan={scan}onClear={() => updateModelsUi({ scan: null })}- onInstall={(path) => void install({ inplace, source: path })}- onInstallAll={(paths) => void installAllSources(paths.map((path) => ({ inplace, source: path })))}+ onInstall={(path) => void install({ config: installConfig, inplace, source: path })}+ onInstallAll={(paths) =>+ void installAllSources(paths.map((path) => ({ config: installConfig, inplace, source: path })))+ }+ onSetFp8Storage={setFp8Storage}onSetInplace={setInplace}/>) : null}diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsxindex 5d0f3d83dd..04922f8500 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsx@@ -8,20 +8,26 @@ import { useInstalledSourceKeys } from '@features/models/ui/shared/useInstalledSimport { sourceFileName, useSourceNameFilter } from '@features/models/ui/shared/useSourceNameFilter';import { useTranslation } from 'react-i18next';+import { InstallOptions } from './InstallOptions';+const urlOf = (url: string): string => url;export const HuggingFaceFiles = ({+ fp8Storage,lookup,onClear,onInstall,onInstallAll,+ onSetFp8Storage,pendingSources,}: {+ fp8Storage: boolean;lookup: HFLookupState;onClear: () => void;onInstall: (url: string) => void;/** Bulk path: the parent queues silently and emits one summary toast. */onInstallAll: (urls: string[]) => void;+ onSetFp8Storage: (fp8Storage: boolean) => void;pendingSources: ReadonlySet<string>;}) => {const { t } = useTranslation();@@ -37,6 +43,7 @@ export const HuggingFaceFiles = ({return (<Stack gap="1.5"><ResultsListHeader+ extra={<InstallOptions fp8Storage={fp8Storage} onSetFp8Storage={onSetFp8Storage} />}installAllDisabled={filteredUrls.length === 0}installAllLabel={t('models.installAllCount', { count: filteredUrls.length })}searchPlaceholder={t('models.filterFiles')}diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/InstallOptions.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/InstallOptions.tsxnew file mode 100644index 0000000000..e02d6da92c--- /dev/null+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/InstallOptions.tsx@@ -0,0 +1,56 @@+/* eslint-disable react-perf/jsx-no-new-function-as-prop */+import { Checkbox, HStack, VisuallyHidden } from '@chakra-ui/react';+import { Tooltip } from '@platform/ui';+import { useId } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * Choices applied to the next install from a source. FP8 storage is an opt-in only: identification already turns it+ * on for checkpoints whose weights are stored in FP8, so leaving the box unticked never turns that off.+ */+export const InstallOptions = ({+ fp8Storage,+ inplace,+ onSetFp8Storage,+ onSetInplace,+}: {+ fp8Storage: boolean;+ /** Omitted, with its setter, for sources that cannot be installed in place (URLs, repos). */+ inplace?: boolean;+ onSetFp8Storage: (fp8Storage: boolean) => void;+ onSetInplace?: (inplace: boolean) => void;+}) => {+ const { t } = useTranslation();+ // The tooltip describes its trigger, the label; the focusable input needs the same text to be announced.+ const fp8StorageDescriptionId = useId();++ return (+ <HStack gap="3">+ {inplace === undefined || onSetInplace === undefined ? null : (+ <Checkbox.Root+ checked={inplace}+ colorPalette="accent"+ size="xs"+ onCheckedChange={(event) => onSetInplace(event.checked === true)}+ >+ <Checkbox.HiddenInput />+ <Checkbox.Control />+ <Checkbox.Label fontSize="2xs">{t('models.installInPlace')}</Checkbox.Label>+ </Checkbox.Root>+ )}+ <Tooltip content={t('models.installFp8StorageTooltip')}>+ <Checkbox.Root+ checked={fp8Storage}+ colorPalette="accent"+ size="xs"+ onCheckedChange={(event) => onSetFp8Storage(event.checked === true)}+ >+ <Checkbox.HiddenInput aria-describedby={fp8StorageDescriptionId} />+ <Checkbox.Control />+ <Checkbox.Label fontSize="2xs">{t('models.installFp8Storage')}</Checkbox.Label>+ </Checkbox.Root>+ </Tooltip>+ <VisuallyHidden id={fp8StorageDescriptionId}>{t('models.installFp8StorageTooltip')}</VisuallyHidden>+ </HStack>+ );+};diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.browser.test.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.browser.test.tsxindex 0425877ed9..8080d44b64 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.browser.test.tsx@@ -46,12 +46,14 @@ const SCAN = { path: '/home/user/downloads', results: [{ is_installed: false, paconst Harness = () => (<ChakraProvider value={system}><ScanResults+ fp8Storage={false}inplacependingSources={NO_PENDING}scan={SCAN}onClear={noop}onInstall={noop}onInstallAll={noop}+ onSetFp8Storage={noop}onSetInplace={noop}/></ChakraProvider>diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsxindex 51fe6f22f5..d7fd6cd00e 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsx@@ -1,7 +1,7 @@/* eslint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */import type { FoundModel } from '@features/models/core/types';-import { Checkbox, HStack, Icon, Stack, Text } from '@chakra-ui/react';+import { HStack, Icon, Stack, Text } from '@chakra-ui/react';import { ResultsListHeader } from '@features/models/ui/shared/ResultsListHeader';import { InstallSourceButton, SourceListItem } from '@features/models/ui/shared/SourceListItem';import { useInstalledSourceKeys } from '@features/models/ui/shared/useInstalledSources';@@ -10,22 +10,28 @@ import { IconButton } from '@platform/ui';import { XIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';+import { InstallOptions } from './InstallOptions';+const pathOf = (result: FoundModel): string => result.path;export const ScanResults = ({+ fp8Storage,inplace,onClear,onInstall,onInstallAll,+ onSetFp8Storage,onSetInplace,pendingSources,scan,}: {+ fp8Storage: boolean;inplace: boolean;onClear: () => void;onInstall: (path: string) => void;/** Bulk path: the parent queues silently and emits one summary toast. */onInstallAll: (paths: string[]) => void;+ onSetFp8Storage: (fp8Storage: boolean) => void;onSetInplace: (inplace: boolean) => void;pendingSources: ReadonlySet<string>;scan: { path: string; results: FoundModel[] };@@ -61,16 +67,12 @@ export const ScanResults = ({<Stack gap="1.5"><ResultsListHeaderextra={- <Checkbox.Root- checked={inplace}- colorPalette="accent"- size="xs"- onCheckedChange={(event) => onSetInplace(event.checked === true)}- >- <Checkbox.HiddenInput />- <Checkbox.Control />- <Checkbox.Label fontSize="2xs">{t('models.installInPlace')}</Checkbox.Label>- </Checkbox.Root>+ <InstallOptions+ fp8Storage={fp8Storage}+ inplace={inplace}+ onSetFp8Storage={onSetFp8Storage}+ onSetInplace={onSetInplace}+ />}installAllDisabled={installable.length === 0}installAllLabel={t('models.installAllCount', { count: installable.length })}diff --git a/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.test.ts b/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.test.tsindex 06cd1dc606..f39412c3b9 100644--- a/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.test.ts+++ b/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.test.ts@@ -12,17 +12,13 @@ const fieldKeys = (candidate: Pick<ModelConfig, 'base' | 'type'>): string[] =>describe('supportsFp8Storage', () => {it('offers the toggle for main models', () => {- for (const base of ['sdxl', 'flux', 'krea-2', 'qwen-image', 'wan', 'ideogram-4']) {+ // Z-Image included: the backend casts it, and FP8 checkpoints get the setting when installed, so+ // hiding the row would leave a setting nobody can see or turn off.+ for (const base of ['sdxl', 'flux', 'krea-2', 'qwen-image', 'wan', 'ideogram-4', 'z-image']) {expect(supportsFp8Storage(model(base, 'main'))).toBe(true);}});- it('hides it for Z-Image, which the backend refuses to cast', () => {- // _should_use_fp8 returns False for BaseModelType.ZImage: diffusers' layerwise casting hits- // a dtype mismatch there (skipped modules bf16, hooked modules fp16).- expect(supportsFp8Storage(model('z-image', 'main'))).toBe(false);- });-it('hides it for LoRA and ControlLoRA, which are patched rather than run', () => {// The casting hooks would never fire, so the toggle would be silently ignored.expect(supportsFp8Storage(model('sdxl', 'lora'))).toBe(false);@@ -58,13 +54,6 @@ describe('getFieldsForModel', () => {]);});- it('omits fp8_storage for a Z-Image main but keeps every other default', () => {- const zImage = fieldKeys(model('z-image', 'main'));-- expect(zImage).not.toContain('fp8_storage');- expect(zImage).toEqual(fieldKeys(model('sdxl', 'main')).filter((key) => key !== 'fp8_storage'));- });-it('gives LoRAs the weight and its slider bounds', () => {expect(fieldKeys(model('sdxl', 'lora'))).toEqual(['weight', 'weight_min', 'weight_max']);});diff --git a/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.ts b/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.tsindex 07d552b12b..f3572b457a 100644--- a/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.ts+++ b/invokeai/frontend/webv2/src/features/models/ui/detail/defaultSettingsFields.ts@@ -215,18 +215,12 @@ const CONTROL_ADAPTER_FIELDS: FieldSpec[] = [/*** Mirrors the backend's `_should_use_fp8` exclusions:- * - Z-Image: diffusers' layerwise casting hits a dtype mismatch on skipped modules.* - LoRA / ControlLoRA: patched into a base model rather than run as their own forward pass, so* the casting hooks would never fire.* VAEs are excluded too, but they have no default-settings section at all.*/-export const supportsFp8Storage = (model: Pick<ModelConfig, 'base' | 'type'>): boolean => {- if (model.base === 'z-image') {- return false;- }-- return model.type === 'main' || model.type === 'controlnet' || model.type === 't2i_adapter';-};+export const supportsFp8Storage = (model: Pick<ModelConfig, 'base' | 'type'>): boolean =>+ model.type === 'main' || model.type === 'controlnet' || model.type === 't2i_adapter';export const getFieldsForModel = (model: Pick<ModelConfig, 'base' | 'type'>): FieldSpec[] => {const fp8Fields = supportsFp8Storage(model) ? [FP8_STORAGE_FIELD] : [];diff --git a/tests/app/services/model_install/test_model_install.py b/tests/app/services/model_install/test_model_install.pyindex 7ed20c9bc8..4c38c3da26 100644--- a/tests/app/services/model_install/test_model_install.py+++ b/tests/app/services/model_install/test_model_install.py@@ -93,6 +93,26 @@ def test_registration_meta_override_succeed(mm2_installer: ModelInstallServiceBaassert model_record.key == "xyzzy"+def test_registration_keeps_the_default_settings_sent_with_the_install(+ mm2_installer: ModelInstallServiceBase, tmp_path: Path+) -> None:+ """Identification computes a model's default settings; the ones a user picked while installing must survive it."""+ import torch+ from safetensors.torch import save_file++ checkpoint = tmp_path / "qwen_image.safetensors"+ save_file(+ {"img_in.weight": torch.zeros(8, 4), "txt_in.weight": torch.zeros(8, 4), "txt_norm.weight": torch.ones(4)},+ str(checkpoint),+ )++ key = mm2_installer.register_path(checkpoint, ModelRecordChanges(default_settings={"fp8_storage": True}))++ record = mm2_installer.record_store.get_model(key)+ assert record.default_settings is not None+ assert record.default_settings.fp8_storage is True++def test_install(mm2_installer: ModelInstallServiceBase, embedding_file: Path, mm2_app_config: InvokeAIAppConfig) -> None:diff --git a/tests/backend/model_manager/configs/test_identified_default_settings.py b/tests/backend/model_manager/configs/test_identified_default_settings.pynew file mode 100644index 0000000000..ae9e44e50b--- /dev/null+++ b/tests/backend/model_manager/configs/test_identified_default_settings.py@@ -0,0 +1,129 @@+"""The default settings a model is identified with.++FP8 Storage is switched on for a checkpoint whose denoiser weights are stored in float8, read from the weights' dtypes+and never from the file name: a Comfy "fp8_scaled" file that nobody renamed and a full-precision file that somebody did+must both come out right. Settings passed along with an install land on top of what identification chose.++Single files are tiny Qwen-Image checkpoints, the smallest main model identification recognises from real keys. Folders+are the installer's SDXL diffusers fixture, whose placeholder weight files have no readable header at all.+"""++import shutil+from pathlib import Path++import pytest+import torch+from safetensors.torch import save_file++from invokeai.backend.model_manager.configs.factory import ModelConfigFactory+from invokeai.backend.model_manager.configs.main import Main_Checkpoint_QwenImage_Config+from invokeai.backend.model_manager.taxonomy import ModelType++_DIFFUSERS_FIXTURE = Path(__file__).parents[1] / "data" / "test_files" / "test-diffusers-main"+++def _qwen_image_checkpoint(path: Path, weight_dtype: torch.dtype, **extra: torch.Tensor) -> Path:+ tensors = {+ "img_in.weight": torch.zeros(8, 4).to(weight_dtype),+ "txt_in.weight": torch.zeros(8, 4).to(weight_dtype),+ "txt_norm.weight": torch.ones(4),+ **extra,+ }+ save_file(tensors, str(path))+ return path+++def _identify(path: Path, override_fields: dict | None = None) -> Main_Checkpoint_QwenImage_Config:+ result = ModelConfigFactory.from_model_on_disk(path, override_fields, allow_unknown=False)+ assert isinstance(result.config, Main_Checkpoint_QwenImage_Config), result.details+ return result.config++[email protected]("fp8_dtype", [torch.float8_e4m3fn, torch.float8_e5m2])+def test_float8_denoiser_weights_turn_fp8_storage_on_whatever_the_file_is_called(tmp_path: Path, fp8_dtype) -> None:+ config = _identify(_qwen_image_checkpoint(tmp_path / "qwen_image.safetensors", fp8_dtype))++ assert config.default_settings is not None+ assert config.default_settings.fp8_storage is True+++def test_a_full_precision_file_named_fp8_is_left_alone(tmp_path: Path) -> None:+ config = _identify(_qwen_image_checkpoint(tmp_path / "qwen_image_fp8_scaled.safetensors", torch.bfloat16))++ assert config.default_settings is None or config.default_settings.fp8_storage is None+++def test_float8_weights_of_a_bundled_text_encoder_do_not_count(tmp_path: Path) -> None:+ """All-in-one checkpoints ship an fp8 text encoder beside a full-precision denoiser; FP8 Storage would re-cast+ that denoiser, which is not what the file is."""+ encoder_weight = torch.zeros(8, 4).to(torch.float8_e4m3fn)+ path = _qwen_image_checkpoint(+ tmp_path / "qwen_image_all_in_one.safetensors",+ torch.bfloat16,+ **{"text_encoders.qwen25_7b.transformer.model.layers.0.mlp.down_proj.weight": encoder_weight},+ )++ config = _identify(path)++ assert config.default_settings is None or config.default_settings.fp8_storage is None+++def _diffusers_folder_with_float8(tmp_path: Path, weight_file: str | None) -> Path:+ folder = tmp_path / "sdxl-diffusers"+ shutil.copytree(_DIFFUSERS_FIXTURE, folder)+ if weight_file is not None:+ save_file({"layer.weight": torch.zeros(8, 4).to(torch.float8_e4m3fn)}, str(folder / weight_file))+ return folder+++def test_a_denoiser_file_whose_header_is_not_a_json_object_does_not_fail_identification(tmp_path: Path) -> None:+ folder = _diffusers_folder_with_float8(tmp_path, None)+ header = b"[]"+ (folder / "unet" / "diffusion_pytorch_model.safetensors").write_bytes(len(header).to_bytes(8, "little") + header)++ result = ModelConfigFactory.from_model_on_disk(folder, allow_unknown=False)++ assert result.config is not None and result.config.type is ModelType.Main, result.details+++ "weight_file, expected",+ [+ ("unet/diffusion_pytorch_model.safetensors", True),+ # The denoiser is what FP8 Storage casts; an FP8 text encoder beside a full-precision UNet does not count.+ ("text_encoder/model.safetensors", None),+ # Unreadable placeholder headers everywhere: nothing to go on, and no reason to fail identification.+ (None, None),+ ],+)+def test_a_diffusers_folder_is_judged_by_its_denoiser_weights(+ tmp_path: Path, weight_file: str | None, expected: bool | None+) -> None:+ folder = _diffusers_folder_with_float8(tmp_path, weight_file)++ result = ModelConfigFactory.from_model_on_disk(folder, allow_unknown=False)++ assert result.config is not None and result.config.type is ModelType.Main, result.details+ settings = result.config.default_settings+ assert (settings.fp8_storage if settings is not None else None) is expected+++def test_an_install_setting_wins_over_detection_in_both_directions(tmp_path: Path) -> None:+ fp8_file = _qwen_image_checkpoint(tmp_path / "fp8.safetensors", torch.float8_e4m3fn)+ full_precision_file = _qwen_image_checkpoint(tmp_path / "bf16.safetensors", torch.bfloat16)++ kept_off = _identify(fp8_file, {"default_settings": {"fp8_storage": False}})+ turned_on = _identify(full_precision_file, {"default_settings": {"fp8_storage": True}})++ assert kept_off.default_settings is not None and kept_off.default_settings.fp8_storage is False+ assert turned_on.default_settings is not None and turned_on.default_settings.fp8_storage is True+++def test_an_install_setting_keeps_the_architectures_other_defaults(tmp_path: Path) -> None:+ path = _qwen_image_checkpoint(tmp_path / "bf16.safetensors", torch.bfloat16)+ probed = _identify(path).default_settings++ overridden = _identify(path, {"default_settings": {"fp8_storage": True}}).default_settings++ assert probed is not None and overridden is not None+ assert overridden.model_dump(exclude={"fp8_storage"}) == probed.model_dump(exclude={"fp8_storage"})diff --git a/tests/backend/model_manager/load/test_load_default_fp8.py b/tests/backend/model_manager/load/test_load_default_fp8.pyindex 9ed38273bf..602ade6f4c 100644--- a/tests/backend/model_manager/load/test_load_default_fp8.py+++ b/tests/backend/model_manager/load/test_load_default_fp8.py@@ -23,7 +23,6 @@ import torchfrom invokeai.backend.model_manager.load.load_default import (_FP8_PROBE_FAILURE_REPORTED,_FP8_STORAGE_SUPPORTED,- _QUANTIZED_MODEL_FORMATS,ModelLoader,_device_supports_fp8_storage,_model_declared_skip_patterns,@@ -430,8 +429,6 @@ def test_should_use_fp8_excludes_quantized_formats(fmt: ModelFormat):unexpectedly`, and bnb NF4 corrupts silently (`bnb.nn.LinearNF4` subclasses `nn.Linear`, so itspacked uint8 payload is cast to float8 and inference then returns finite garbage).- Parametrized over `ModelFormat` members rather than raw strings: `_QUANTIZED_MODEL_FORMATS`- holds strings, so testing it with strings would pass even if the enum values drifted."""loader = _make_loader(device="cuda")config = _make_config(ModelType.Main, fp8=True)@@ -439,16 +436,6 @@ def test_should_use_fp8_excludes_quantized_formats(fmt: ModelFormat):assert loader._should_use_fp8(config) is False-def test_quantized_format_set_matches_the_taxonomy():- """Every entry in `_QUANTIZED_MODEL_FORMATS` must still name a real `ModelFormat` value.-- The set is declared as raw strings to keep `load_default` free of a taxonomy import at module- scope, so nothing else stops a rename in `ModelFormat` from silently disabling the check —- `config.format` would simply never match again, and FP8 would be re-enabled for that format.- """- assert _QUANTIZED_MODEL_FORMATS <= {fmt.value for fmt in ModelFormat}--def test_apply_fp8_skips_quantized_params_regardless_of_format():"""Backstop behind the format check, for quantization the model's format does not reveal(e.g. a `diffusers`-format checkpoint quantized by an external tool).