Add runtime check and detailed error handling for failed model loading
This commit is contained in:
@@ -664,6 +664,14 @@ def generate(
|
|||||||
"install accelerate for low_cpu_mem_usage: pip install accelerate. "
|
"install accelerate for low_cpu_mem_usage: pip install accelerate. "
|
||||||
f"Errors: {load_errors}"
|
f"Errors: {load_errors}"
|
||||||
) from (last_err or Exception("No pipeline loaded"))
|
) from (last_err or Exception("No pipeline loaded"))
|
||||||
|
if gen_pipe is None:
|
||||||
|
mode = "offline/local-cache" if local_files_only() else "online"
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Failed to load model '{model_path}' in {mode} mode. "
|
||||||
|
"The local single-file checkpoint needs the bundled SDXL config and locally cached "
|
||||||
|
"tokenizer/text-encoder metadata. "
|
||||||
|
f"Errors: {load_errors}"
|
||||||
|
)
|
||||||
if gen_pipe.vae is None and is_sdxl:
|
if gen_pipe.vae is None and is_sdxl:
|
||||||
try:
|
try:
|
||||||
vae = vae or AutoencoderKL.from_pretrained(
|
vae = vae or AutoencoderKL.from_pretrained(
|
||||||
|
|||||||
Reference in New Issue
Block a user