浏览代码

fix the issue with /sdapi/v1/options failing (this time for sure!)
fix automated tests downloading CLIP model

AUTOMATIC1111 2 年之前
父节点
当前提交
b270ded268
共有 4 个文件被更改,包括 5 次插入5 次删除
  1. 1 0
      .github/workflows/run_tests.yaml
  2. 2 4
      modules/api/models.py
  3. 1 0
      modules/cmd_args.py
  4. 1 1
      modules/sd_models.py

+ 1 - 0
.github/workflows/run_tests.yaml

@@ -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

+ 2 - 4
modules/api/models.py

@@ -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))})

+ 1 - 0
modules/cmd_args.py

@@ -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",)

+ 1 - 1
modules/sd_models.py

@@ -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