Skip to content

Commit

Permalink
revise sd_model_checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyongliang committed Dec 7, 2022
1 parent 366b4c1 commit 1eb35d5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
23 changes: 13 additions & 10 deletions modules/sd_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,20 @@ def __init__(self, sd_model_name, sd_model_hash, sd_model_checkpoint, sd_checkpo
shared.opts.data['sd_model_checkpoint'] = title

checkpoints_list[title] = CheckpointInfo(filename, title, h, short_model_name, config)

sd_model_checkpoint = shared.opts.data['sd_model_checkpoint']
sd_checkpoint_info = checkpoints_list[sd_model_checkpoint]
sd_model_name = checkpoints_list[sd_model_checkpoint].model_name
sd_model_hash = checkpoints_list[sd_model_checkpoint].hash
shared.sd_model = SDModel(
sd_model_name,
sd_model_hash,
sd_model_checkpoint,
sd_checkpoint_info
)
if sd_model_checkpoint:
sd_checkpoint_info = checkpoints_list[sd_model_checkpoint]
sd_model_name = checkpoints_list[sd_model_checkpoint].model_name
sd_model_hash = checkpoints_list[sd_model_checkpoint].hash
shared.sd_model = SDModel(
sd_model_name,
sd_model_hash,
sd_model_checkpoint,
sd_checkpoint_info
)
else:
shared.sd_model = None
else:
model_list = modelloader.load_models(model_path=model_path, command_path=shared.cmd_opts.ckpt_dir, ext_filter=[".ckpt"])

Expand Down
11 changes: 6 additions & 5 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2172,14 +2172,15 @@ def user_signup(signup_username, signup_password, signup_email):
return {
signup_output: gr.update(value='Signup failed, please check and retry again')
}

def user_signout():
shared.username=''
opts.data = shared.default_options
for key in sd_models.checkpoints_list:
if sd_models.checkpoints_list[key].title == opts.data['sd_model_checkpoint']:
shared.sd_model.sd_model_name = sd_models.checkpoints_list[key].model_name
break
if 'sd_model_checkpoint' in opts.data:
for key in sd_models.checkpoints_list:
if sd_models.checkpoints_list[key].title == opts.data['sd_model_checkpoint']:
shared.sd_model.sd_model_name = sd_models.checkpoints_list[key].model_name
break

response = {
user_login_row : gr.update(visible=False),
Expand Down

0 comments on commit 1eb35d5

Please sign in to comment.