Studio diffusion: fix static compile shape registration and prequant path validation
Register the dims the forward actually compiled with: image-conditioned workflows (img2img, inpaint, upscale, edit) run at the input image's size, not the slider's, so recording the slider values marked never-compiled shapes as covered and warm restarts kept paying compile for the real one. Validate a request-supplied transformer_prequant_path (existence plus the UNSLOTH_ALLOW_LOCAL_PREQUANT_PATH allowlist) before treating prequant as available at the resident-fit re-check: an unusable path skipped the dense fit check up front and then fell back to materializing dense bf16 after the previous pipeline was evicted, recreating the post-eviction OOM path. Shared as usable_prequant_source, also used by the auto-policy planner.
This commit is contained in:
parent
316c8b5a81
commit
e1fa4fec04
5 changed files with 216 additions and 12 deletions
|
|
@ -139,6 +139,26 @@ def resolve_prequant_source(
|
|||
return None
|
||||
|
||||
|
||||
def usable_prequant_source(
|
||||
fam: Any,
|
||||
scheme: str,
|
||||
*,
|
||||
path_override: Optional[str] = None,
|
||||
) -> Optional[PrequantSource]:
|
||||
"""``resolve_prequant_source``, but a request-supplied local path counts only when
|
||||
the loader would actually accept it: inside the ``UNSLOTH_ALLOW_LOCAL_PREQUANT_PATH``
|
||||
allowlist AND present on disk. A path that fails either check resolves to None so
|
||||
memory planning falls back to the dense-fit checks up front -- otherwise
|
||||
``load_prequantized_transformer`` refuses the path only AFTER the resident pipeline
|
||||
was evicted, and the dense bf16 fallback then materialises under a plan that never
|
||||
budgeted for it (the evict-then-OOM those checks exist to prevent). Hosted-repo
|
||||
sources are unaffected."""
|
||||
src = resolve_prequant_source(fam, scheme, path_override = path_override)
|
||||
if src is not None and src.kind == "path" and not local_prequant_path_ready(src.location):
|
||||
return None
|
||||
return src
|
||||
|
||||
|
||||
def load_prequantized_transformer(
|
||||
transformer_cls: Any,
|
||||
base: str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue