diff --git a/configs/models.yaml b/configs/models.yaml.example similarity index 50% rename from configs/models.yaml rename to configs/models.yaml.example index d2421137ca..b42301e7c7 100644 --- a/configs/models.yaml +++ b/configs/models.yaml.example @@ -13,3 +13,16 @@ stable-diffusion-1.5: height: 512 vae: ./models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt default: true +stable-diffusion-1.4: + description: Stable Diffusion inference model version 1.4 + config: configs/stable-diffusion/v1-inference.yaml + weights: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt + vae: models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt + width: 512 + height: 512 +inpainting-1.5: + weights: models/ldm/stable-diffusion-v1/sd-v1-5-inpainting.ckpt + config: configs/stable-diffusion/v1-inpainting-inference.yaml + vae: models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt + description: RunwayML SD 1.5 model optimized for inpainting + \ No newline at end of file diff --git a/scripts/preload_models.py b/scripts/preload_models.py index e545323b4d..3fac4c6a0a 100644 --- a/scripts/preload_models.py +++ b/scripts/preload_models.py @@ -321,22 +321,31 @@ def download_with_resume(repo_id:str, model_name:str, access_token:str)->bool: #--------------------------------------------- def update_config_file(successfully_downloaded:dict): + yaml = new_config_file_contents(successfully_downloaded) + try: - yaml = new_config_file_contents(successfully_downloaded) + if os.path.exists(Config_file): + print(f'** {Config_file} exists. Renaming to {Config_file}.orig') + os.rename(Config_file,f'{Config_file}.orig') tmpfile = os.path.join(os.path.dirname(Config_file),'new_config.tmp') with open(tmpfile, 'w') as outfile: outfile.write(Config_preamble) outfile.write(yaml) os.rename(tmpfile,Config_file) + except Exception as e: print(f'**Error creating config file {Config_file}: {str(e)} **') return + print(f'Successfully created new configuration file {Config_file}') #--------------------------------------------- def new_config_file_contents(successfully_downloaded:dict)->str: - conf = OmegaConf.load(Config_file) + if os.path.exists(Config_file): + conf = OmegaConf.load(Config_file) + else: + conf = OmegaConf.create() # find the VAE file, if there is one vae = None