Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kizzs branch #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/api/ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import os


ray.init(os.environ.get("RAY_HEAD_ADDRESS", ""))
#ray.init(os.environ.get("RAY_HEAD_ADDRESS", ""))
#ray.init("ray://localhost:10001")

ray.init()

def ray_only():
serve.shutdown()
Expand Down
8 changes: 7 additions & 1 deletion modules/sd_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,13 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None):
model_data.set_sd_model(sd_model)
model_data.was_loaded_at_least_once = True

# Check if shared.sd_model is initialized and has 'cond_stage_model' attribute
if shared.sd_model is None or not hasattr(shared.sd_model, 'cond_stage_model'):
# Initialize shared.sd_model or add 'cond_stage_model' attribute
# The following is just a placeholder, replace it with actual initialization code
shared.sd_model = instantiate_from_config(sd_config.model)
shared.sd_model.cond_stage_model = instantiate_from_config(sd_config.cond_stage_model)

sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True) # Reload embeddings after model load as they may or may not fit the model

timer.record("load textual inversion embeddings")
Expand All @@ -654,7 +661,6 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None):

return sd_model


def reuse_model_from_already_loaded(sd_model, checkpoint_info, timer):
"""
Checks if the desired checkpoint from checkpoint_info is not already loaded in model_data.loaded_sd_models.
Expand Down
12 changes: 10 additions & 2 deletions modules/textual_inversion/textual_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,17 @@ def register_embedding_by_name(self, embedding, model, name):
self.word_embeddings[name] = embedding
return embedding

# def get_expected_shape(self):
# vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
# return vec.shape[1]

def get_expected_shape(self):
vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
return vec.shape[1]
if shared.sd_model is None or not hasattr(shared.sd_model, 'cond_stage_model'):
# Handle the error appropriately, e.g., by raising an exception or returning a default value
raise ValueError("shared.sd_model is not initialized or does not have a 'cond_stage_model' attribute")
else:
vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
return vec.shape[1]

def load_from_file(self, path, filename):
name, ext = os.path.splitext(filename)
Expand Down
2 changes: 1 addition & 1 deletion webui-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export RAY_MIN_REPLICAS=0
export RAY_MAX_REPLICAS=2
export RAY_PORT=7575
export RAY_IP="0.0.0.0"
#export RAY_HEAD_ADDRESS='ray://ray-head:10001'
export RAY_HEAD_ADDRESS='ray://ray-head:10001'