ToB企服应用市场:ToB评测及商务社交产业平台

标题: stable-diffusion-webui在conda pycharm中运行 [打印本页]

作者: 悠扬随风    时间: 2024-12-22 21:36
标题: stable-diffusion-webui在conda pycharm中运行
简介


下载


  1. git clone git@github.com:AUTOMATIC1111/stable-diffusion-webui.git
复制代码
conda环境


  1. conda create -n sd python=3.10.6
  2. conda activate sd
复制代码

  1. pip install -r requirements.txt
复制代码
配置环境变量


  1. CUDA_VISIBLE_DEVICES=-1
  2. COMMANDLINE_ARGS=--use-cpu all --no-half --precision full --skip-torch-cuda-test
复制代码

修改launch_utils.py文件


  1. def prepare_environment():
  2.     torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu121")
  3.     torch_command = os.environ.get('TORCH_COMMAND', f"pip install --timeout=9999 torch==2.1.2 torchvision==0.16.2 --extra-index-url {torch_index_url}")
  4.     if args.use_ipex:
  5.         if platform.system() == "Windows":
  6.             # The "Nuullll/intel-extension-for-pytorch" wheels were built from IPEX source for Intel Arc GPU: https://github.com/intel/intel-extension-for-pytorch/tree/xpu-main
  7.             # This is NOT an Intel official release so please use it at your own risk!!
  8.             # See https://github.com/Nuullll/intel-extension-for-pytorch/releases/tag/v2.0.110%2Bxpu-master%2Bdll-bundle for details.
  9.             #
  10.             # Strengths (over official IPEX 2.0.110 windows release):
  11.             #   - AOT build (for Arc GPU only) to eliminate JIT compilation overhead: https://github.com/intel/intel-extension-for-pytorch/issues/399
  12.             #   - Bundles minimal oneAPI 2023.2 dependencies into the python wheels, so users don't need to install oneAPI for the whole system.
  13.             #   - Provides a compatible torchvision wheel: https://github.com/intel/intel-extension-for-pytorch/issues/465
  14.             # Limitation:
  15.             #   - Only works for python 3.10
  16.             url_prefix = "https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle"
  17.             torch_command = os.environ.get('TORCH_COMMAND', f"pip install --timeout=9999 {url_prefix}/torch-2.0.0a0+gite9ebda2-cp310-cp310-win_amd64.whl {url_prefix}/torchvision-0.15.2a0+fa99a53-cp310-cp310-win_amd64.whl {url_prefix}/intel_extension_for_pytorch-2.0.110+gitc6ea20b-cp310-cp310-win_amd64.whl")
  18.         else:
  19.             # Using official IPEX release for linux since it's already an AOT build.
  20.             # However, users still have to install oneAPI toolkit and activate oneAPI environment manually.
  21.             # See https://intel.github.io/intel-extension-for-pytorch/index.html#installation for details.
  22.             torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://pytorch-extension.intel.com/release-whl/stable/xpu/us/")
  23.             torch_command = os.environ.get('TORCH_COMMAND', f"pip install --timeout=9999 torch==2.0.0a0 intel-extension-for-pytorch==2.0.110+gitba7f6c1 --extra-index-url {torch_index_url}")
  24.     requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
  25.     requirements_file_for_npu = os.environ.get('REQS_FILE_FOR_NPU', "requirements_npu.txt")
  26.     xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.23.post1')
  27.     clip_package = os.environ.get('CLIP_PACKAGE', "https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip")
  28.     openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")
  29.     assets_repo = os.environ.get('ASSETS_REPO', "git@github.com:AUTOMATIC1111/stable-diffusion-webui-assets.git")
  30.     stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "git@github.com:Stability-AI/stablediffusion.git")
  31.     stable_diffusion_xl_repo = os.environ.get('STABLE_DIFFUSION_XL_REPO', "git@github.com:Stability-AI/generative-models.git")
  32.     k_diffusion_repo = os.environ.get('K_DIFFUSION_REPO', 'git@github.com:crowsonkb/k-diffusion.git')
  33.     blip_repo = os.environ.get('BLIP_REPO', 'git@github.com:salesforce/BLIP.git')
  34. ...省略...
复制代码
运行stable-diffusion-webui


下载模子


文本天生图片


参考



免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4