fix the issue with /sdapi/v1/options failing (this time for sure!)

fix automated tests downloading CLIP model
This commit is contained in:
AUTOMATIC1111 2023-07-18 18:10:04 +03:00
parent be16d274f8
commit b270ded268
4 changed files with 5 additions and 5 deletions

View File

@ -41,6 +41,7 @@ jobs:
--skip-prepare-environment
--skip-torch-cuda-test
--test-server
--do-not-download-clip
--no-half
--disable-opt-split-attention
--use-cpu all

View File

@ -209,11 +209,9 @@ class PreprocessResponse(BaseModel):
fields = {}
for key, metadata in opts.data_labels.items():
value = opts.data.get(key)
if key == 'sd_model_checkpoint':
value = None
optType = opts.typemap.get(type(metadata.default), type(value))
optType = opts.typemap.get(type(metadata.default), type(metadata.default))
if isinstance(optType, types.NoneType):
if metadata.default is None:
pass
elif metadata is not None:
fields.update({key: (Optional[optType], Field(default=metadata.default, description=metadata.label))})

View File

@ -15,6 +15,7 @@ parser.add_argument("--update-check", action='store_true', help="launch.py argum
parser.add_argument("--test-server", action='store_true', help="launch.py argument: configure server for testing")
parser.add_argument("--skip-prepare-environment", action='store_true', help="launch.py argument: skip all environment preparation")
parser.add_argument("--skip-install", action='store_true', help="launch.py argument: skip installation of packages")
parser.add_argument("--do-not-download-clip", action='store_true', help="do not download CLIP model even if it's not included in the checkpoint")
parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored")
parser.add_argument("--config", type=str, default=sd_default_config, 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",)

View File

@ -494,7 +494,7 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None):
sd_model = None
try:
with sd_disable_initialization.DisableInitialization(disable_clip=clip_is_included_into_sd):
with sd_disable_initialization.DisableInitialization(disable_clip=clip_is_included_into_sd or shared.cmd_opts.do_not_download_clip):
sd_model = instantiate_from_config(sd_config.model)
except Exception:
pass