当前位置:AIGC资讯 > AIGC > 正文

Stable Diffusion运行Deforum报错问题解决

运行Deforum时,需要在线下载dpt_large-midas-2f21e586.pt

Downloading: "https://github.com/intel-isl/DPT/releases/download/1_0/dpt_large-midas-2f21e586.pt" to C:\sd-webui-aki\sd-webui-aki-v4.1\models\Deforum\dpt_large-midas-2f21e586.pt

可能会遇到报错信息Check your schedules/ init values please. Also make sure you don't have a backwards slash in any of your PATHs - use / instead of \.

*START OF TRACEBACK*
Traceback (most recent call last):
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers\run_deforum.py", line 78, in run_deforum
    render_animation(args, anim_args, video_args, parseq_args, loop_args, controlnet_args, root)
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers\render.py", line 109, in render_animation
    depth_model = DepthModel(root.models_path, device, root.half_precision, keep_in_vram=keep_in_vram, depth_algorithm=anim_args.depth_algorithm, Width=args.W, Height=args.H,
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers\depth.py", line 32, in __new__
    cls._instance._initialize(models_path=args[0], device=args[1], half_precision=not cmd_opts.no_half, keep_in_vram=keep_in_vram, depth_algorithm=depth_algorithm, Width=Width, Height=Height, midas_weight=midas_weight)
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers\depth.py", line 48, in _initialize
    self._initialize_model()
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers\depth.py", line 63, in _initialize_model
    self.midas_depth = MidasDepth(self.models_path, self.device, half_precision=self.half_precision, midas_model_type=self.depth_algorithm)
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers\depth_midas.py", line 33, in __init__
*END OF TRACEBACK*
    download_file_with_checksum(url=self.midas_model_url, expected_checksum=self.midas_model_checksum, dest_folder=models_path, dest_filename=self.midas_model_filename)
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers\general_utils.py", line 128, in download_file_with_checksum
    raise Exception(f"Error while downloading {dest_filename}.]nPlease manually download from: {url}\nAnd place it in: {dest_folder}")

User friendly error message:
Exception: Error while downloading dpt_large-midas-2f21e586.pt.]nPlease manually download from: https://github.com/intel-isl/DPT/releases/download/1_0/dpt_large-midas-2f21e586.pt
提示:Python 运行时抛出了一个异常。请检查疑难解答页面。
And place it in: C:\sd-webui-aki\sd-webui-aki-v4.1\models/Deforum
Error: Error while downloading dpt_large-midas-2f21e586.pt.]nPlease manually download from: https://github.com/intel-isl/DPT/releases/download/1_0/dpt_large-midas-2f21e586.pt
And place it in: C:\sd-webui-aki\sd-webui-aki-v4.1\models/Deforum. Check your schedules/ init values please. Also make sure you don't have a backwards slash in any of your PATHs - use / instead of \.

根据log提示,修改C:\sd-webui-aki\sd-webui-aki-v4.1\extensions\deforum-for-automatic1111-webui\scripts\deforum_helpers目录下的general_utils.py文件最后的download_file_with_checksum(url, expected_checksum, dest_folder, dest_filename)方法,添加replace替换操作。

def download_file_with_checksum(url, expected_checksum, dest_folder, dest_filename):
    dest_folder=dest_folder.replace("\\", "/")
    expected_full_path = os.path.join(dest_folder, dest_filename)
    expected_full_path=expected_full_path.replace("\\", "/")
    if not os.path.exists(expected_full_path) and not os.path.isdir(expected_full_path):
        load_file_from_url(url=url, model_dir=dest_folder, file_name=dest_filename, progress=True)
        if checksum(expected_full_path) != expected_checksum:
            raise Exception(f"Error while downloading {dest_filename}.]nPlease manually download from: {url}\nAnd place it in: {dest_folder}")

然后重新运行sd-webui,若报错

Loading MiDaS model from dpt_large-midas-2f21e586.pt...
Error verifying pickled file from C:\sd-webui-aki\sd-webui-aki-v4.1\models/Deforum\dpt_large-midas-2f21e586.pt:
Traceback (most recent call last):
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\modules\safe.py", line 82, in check_pt
    with zipfile.ZipFile(filename) as z:
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\zipfile.py", line 1269, in __init__
    self._RealGetContents()
  File "C:\sd-webui-aki\sd-webui-aki-v4.1\python\lib\zipfile.py", line 1336, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

则删除Deforum插件,并且删除本地目录 C:\sd-webui-aki\sd-webui-aki-v4.1\models/Deforum\下的dpt_large-midas-2f21e586.pt文件。重新安装Deforum插件,并运行,会重新下载该文件。

最后重新运行即可。

更新时间 2023-12-06