mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
allow checkpoint config files to use root-relative paths
This commit is contained in:
parent
72b44f7ebc
commit
27622dfd5e
@ -44,7 +44,7 @@ class ControlNetLoader(GenericDiffusersLoader):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self._logger.info(f"Converting {model_path} to diffusers format")
|
self._logger.info(f"Converting {model_path} to diffusers format")
|
||||||
with open(config.config_path, "r") as config_stream:
|
with open(self._app_config.root_path / config.config_path, "r") as config_stream:
|
||||||
convert_controlnet_to_diffusers(
|
convert_controlnet_to_diffusers(
|
||||||
model_path,
|
model_path,
|
||||||
output_path,
|
output_path,
|
||||||
|
@ -91,7 +91,7 @@ class StableDiffusionDiffusersModel(GenericDiffusersLoader):
|
|||||||
model_path,
|
model_path,
|
||||||
output_path,
|
output_path,
|
||||||
model_type=self.model_base_to_model_type[base],
|
model_type=self.model_base_to_model_type[base],
|
||||||
original_config_file=config.config_path,
|
original_config_file=self._app_config.root_path / config.config_path,
|
||||||
extract_ema=True,
|
extract_ema=True,
|
||||||
from_safetensors=model_path.suffix == ".safetensors",
|
from_safetensors=model_path.suffix == ".safetensors",
|
||||||
precision=self._torch_dtype,
|
precision=self._torch_dtype,
|
||||||
|
@ -44,7 +44,7 @@ class VAELoader(GenericDiffusersLoader):
|
|||||||
raise Exception(f"VAE conversion not supported for model type: {config.base}")
|
raise Exception(f"VAE conversion not supported for model type: {config.base}")
|
||||||
else:
|
else:
|
||||||
assert isinstance(config, CheckpointConfigBase)
|
assert isinstance(config, CheckpointConfigBase)
|
||||||
config_file = config.config_path
|
config_file = self._app_config.root_path / config.config_path
|
||||||
|
|
||||||
if model_path.suffix == ".safetensors":
|
if model_path.suffix == ".safetensors":
|
||||||
checkpoint = safetensors_load_file(model_path, device="cpu")
|
checkpoint = safetensors_load_file(model_path, device="cpu")
|
||||||
@ -55,7 +55,7 @@ class VAELoader(GenericDiffusersLoader):
|
|||||||
if "state_dict" in checkpoint:
|
if "state_dict" in checkpoint:
|
||||||
checkpoint = checkpoint["state_dict"]
|
checkpoint = checkpoint["state_dict"]
|
||||||
|
|
||||||
ckpt_config = OmegaConf.load(self._app_config.root_path / config_file)
|
ckpt_config = OmegaConf.load(config_file)
|
||||||
assert isinstance(ckpt_config, DictConfig)
|
assert isinstance(ckpt_config, DictConfig)
|
||||||
self._logger.info(f"Converting {model_path} to diffusers format")
|
self._logger.info(f"Converting {model_path} to diffusers format")
|
||||||
vae_model = convert_ldm_vae_to_diffusers(
|
vae_model = convert_ldm_vae_to_diffusers(
|
||||||
|
Loading…
Reference in New Issue
Block a user