Skip to content

Commit

Permalink
Merge pull request #4 from 920232796/master
Browse files Browse the repository at this point in the history
add hash and fix undo hijack bug
  • Loading branch information
marscrazy committed Dec 6, 2022
2 parents a25dfeb + 965fc5a commit 9a5c689
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ def prepare_enviroment():

os.makedirs(dir_repos, exist_ok=True)

git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", )
git_clone(taming_transformers_repo, repo_dir('taming-transformers'), "Taming Transformers", )
git_clone(k_diffusion_repo, repo_dir('k-diffusion'), "K-diffusion", )
git_clone(codeformer_repo, repo_dir('CodeFormer'), "CodeFormer", )
git_clone(blip_repo, repo_dir('BLIP'), "BLIP", )
git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", stable_diffusion_commit_hash)
git_clone(taming_transformers_repo, repo_dir('taming-transformers'), "Taming Transformers", taming_transformers_commit_hash)
git_clone(k_diffusion_repo, repo_dir('k-diffusion'), "K-diffusion", k_diffusion_commit_hash)
git_clone(codeformer_repo, repo_dir('CodeFormer'), "CodeFormer", codeformer_commit_hash)
git_clone(blip_repo, repo_dir('BLIP'), "BLIP", blip_commit_hash)

if not is_installed("lpips"):
run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}", "requirements for CodeFormer")
Expand Down
6 changes: 5 additions & 1 deletion modules/sd_hijack.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ def flatten(el):
self.layers = flatten(m)

def undo_hijack(self, m):
if type(m.cond_stage_model) == sd_hijack_clip.FrozenCLIPEmbedderWithCustomWords:

if shared.text_model_name == "XLMR-Large":
m.cond_stage_model = m.cond_stage_model.wrapped

elif type(m.cond_stage_model) == sd_hijack_clip.FrozenCLIPEmbedderWithCustomWords:
m.cond_stage_model = m.cond_stage_model.wrapped

model_embeddings = m.cond_stage_model.transformer.text_model.embeddings
Expand Down
2 changes: 1 addition & 1 deletion modules/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
sd_model_file = os.path.join(script_path, 'model.ckpt')
default_sd_model_file = sd_model_file
parser = argparse.ArgumentParser()
parser.add_argument("--config", type=str, default="configs/altdiffusion/ad-inference.yaml", help="path to config which constructs model",)
parser.add_argument("--config", type=str, default=os.path.join(script_path, "v1-inference.yaml"), help="path to config which constructs model",)
parser.add_argument("--ckpt", type=str, default=sd_model_file, help="path to checkpoint of stable diffusion model; if specified, this checkpoint will be added to the list of checkpoints and loaded",)
parser.add_argument("--ckpt-dir", type=str, default=None, help="Path to directory with stable diffusion checkpoints")
parser.add_argument("--gfpgan-dir", type=str, help="GFPGAN directory", default=('./src/gfpgan' if os.path.exists('./src/gfpgan') else './GFPGAN'))
Expand Down
1 change: 1 addition & 0 deletions v2-inference.yaml → v2-inference-v.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ model:
base_learning_rate: 1.0e-4
target: ldm.models.diffusion.ddpm.LatentDiffusion
params:
parameterization: "v"
linear_start: 0.00085
linear_end: 0.0120
num_timesteps_cond: 1
Expand Down

0 comments on commit 9a5c689

Please sign in to comment.