You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

购买PAYG额度后Disco与Stable Diffusion均报错求助

问题描述

购买按使用付费(PAYG)额度后,Disco Diffusion和Stable Diffusion均出现报错,已清理Google Drive并重新加载程序(含正确放置在models文件夹的.ckpt文件),但错误仍存在。


Disco Diffusion 报错:FileNotFoundError

报错详情

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-191981527364> in <module>
     38 import py3d_tools as p3d
     39 
---> 40 from helpers import DepthModel, sampler_fn
     41 from k_diffusion.external import CompVisDenoiser
     42 from ldm.util import instantiate_from_config

4 frames
/content/MiDaS/midas/backbones/next_vit.py in <module>
      6 from .utils import activations, forward_default, get_activation
      7 
----> 8 file = open("./externals/Next_ViT/classification/nextvit.py", "r")
      9 source_code = file.read().replace(" utils", " externals.Next_ViT.classification.utils")
     10 exec(source_code)

FileNotFoundError: [Errno 2] No such file or directory: './externals/Next_ViT/classification/nextvit.py'

原因

依赖的Next_ViT模块文件缺失,大概率是仓库克隆时子模块未拉取完整,或是PAYG环境的目录结构与本地不一致。

解决步骤

  • 先检查目标路径是否存在,在终端执行:
    ls -la ./externals/
    
  • 若Next_ViT目录不存在,重新拉取所有子模块:
    git submodule update --init --recursive
    
  • 若是云端环境(如Colab),重新运行安装依赖的代码单元格,确保所有子模块和依赖下载完整。
  • 手动补全缺失文件:将Next_ViT仓库克隆到指定路径
    git clone https://github.com/bytedance/Next-ViT.git ./externals/Next_ViT/
    

Stable Diffusion 报错:NameError

报错详情

NameError                                 Traceback (most recent call last)
<ipython-input-5-d64464a7a6a5> in <module>
    154 if load_on_run_all and ckpt_valid:
    155     local_config = OmegaConf.load(f"{ckpt_config_path}")
--> 156     model = load_model_from_config(local_config, f"{ckpt_path}", half_precision=half_precision)
    157     device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
    158     model = model.to(device)

<ipython-input-5-d64464a7a6a5> in load_model_from_config(config, ckpt, verbose, device, half_precision)
    136         print(f"Global Step: {pl_sd['global_step']}")
    137     sd = pl_sd["state_dict"]
--> 138     model = instantiate_from_config(config.model)
    139     m, u = model.load_state_dict(sd, strict=False)
    140     if len(m) > 0 and verbose:

原因

instantiate_from_config函数无法正常执行,可能是配置文件结构错误、依赖库未正确导入,或是.ckpt文件与配置不匹配。

解决步骤

  • 检查配置文件结构,确保config.model包含正确的target字段(指定模型类路径),示例格式:
    model:
      target: ldm.models.diffusion.ddpm.LatentDiffusion
      params:
        # 其他必要参数
    
  • 确认代码开头已导入instantiate_from_config:
    from ldm.util import instantiate_from_config
    
    若缺失则添加该导入语句。
  • 验证.ckpt文件与配置文件的兼容性,确保使用对应模型版本的官方配置(如Stable Diffusion v1.5对应v1-inference.yaml)。
  • 重新安装依赖,确保库版本正确:
    pip install -r requirements.txt
    
  • 检查ckpt_path和ckpt_config_path是否指向正确的文件路径,避免路径错误导致加载失败。

内容的提问来源于stack exchange,提问作者kate kate

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 13:15:51