Skip to content

Commit 3ef8418

Browse files
committed
Add requirements-win-torch-1-11-0.txt to fix Windows installs with PyTorch 1.12.1
1 parent f9fed25 commit 3ef8418

File tree

7 files changed

+55
-14
lines changed

7 files changed

+55
-14
lines changed

__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
from .property_groups.dream_prompt import DreamPrompt
4545

4646
requirements_path_items = (
47-
('requirements-lin-AMD.txt', 'Linux (AMD)', 'Linux with AMD GPU'),
48-
('requirements-lin-win-colab-CUDA.txt', 'Linux/Windows (CUDA)', 'Linux or Windows with NVIDIA GPU'),
49-
('requirements-mac-MPS-CPU.txt', 'Apple Silicon', 'Apple M1/M2'),
47+
# Use the old version of requirements-win.txt to fix installation issues with Blender + PyTorch 1.12.1
48+
('requirements-win-torch-1-11-0.txt', 'Linux/Windows (CUDA)', 'Linux or Windows with NVIDIA GPU'),
49+
('stable_diffusion/requirements-mac-MPS-CPU.txt', 'Apple Silicon', 'Apple M1/M2'),
50+
('stable_diffusion/requirements-lin-AMD.txt', 'Linux (AMD)', 'Linux with AMD GPU'),
5051
)
5152

5253
def register():
@@ -59,7 +60,7 @@ def register():
5960
sys.path.append(absolute_path("stable_diffusion/src/taming-transformers"))
6061

6162
set_dependencies_installed(False)
62-
bpy.types.Scene.dream_textures_requirements_path = EnumProperty(name="Platform", items=requirements_path_items, description="Specifies which set of dependencies to install", default='requirements-mac-MPS-CPU.txt' if sys.platform == 'darwin' else 'requirements-lin-win-colab-CUDA.txt')
63+
bpy.types.Scene.dream_textures_requirements_path = EnumProperty(name="Platform", items=requirements_path_items, description="Specifies which set of dependencies to install", default='stable_diffusion/requirements-mac-MPS-CPU.txt' if sys.platform == 'darwin' else 'requirements-win-torch-1-11-0.txt')
6364

6465
register_section_props()
6566

help_section.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def faq_box(is_open, title, steps):
8181
title="It still doesn't work!",
8282
steps=[
8383
"Reinstall Blender 3.3 fresh from blender.org then try installing the addon again.",
84+
"You can completely reset your Blender system by deleting 'C:\\Program Files\\Blender Foundation' and 'C:\\Users\\[YOU]\\AppData\\Roaming\\Blender Foundation'" if sys.platform == 'win32' else None,
8485
"If you are still unable to fix the issue, please file a bug on GitHub. Include the following:",
8586
"1. The logs of the error found from the system console",
8687
"2. Your graphics card specifications.",

operators/dream_texture.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,14 @@ async def dream_texture(self, context):
124124
weights = absolute_path('stable_diffusion/' + models[model].weights)
125125

126126
global generator
127-
if generator is None:
127+
if generator is None or generator.full_precision != context.scene.dream_textures_prompt.full_precision:
128128
generator = Generate(
129129
conf=models_config,
130130
model=model,
131131
# These args are deprecated, but we need them to specify an absolute path to the weights.
132132
weights=weights,
133-
config=config
133+
config=config,
134+
full_precision=context.scene.dream_textures_prompt.full_precision
134135
)
135136
generator.load_model()
136137

@@ -223,6 +224,9 @@ def perform():
223224
# path to an initial image - its dimensions override width and height
224225
init_img=init_img_path,
225226

227+
# generate tileable/seamless textures
228+
seamless=scene.dream_textures_prompt.seamless,
229+
226230
fit=scene.dream_textures_prompt.fit,
227231
# strength for noising/unnoising init_img. 0.0 preserves image exactly, 1.0 replaces it completely
228232
strength=scene.dream_textures_prompt.strength,

operators/install_dependencies.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,11 @@ def members(tf):
117117
requirements_path = requirements_txt
118118
if requirements_path is None:
119119
if sys.platform == 'darwin': # Use MPS dependencies list on macOS
120-
requirements_path = 'requirements-mac-MPS-CPU.txt'
121-
else: # Use CUDA dependencies by default on Linux/Windows
122-
requirements_path = 'requirements-lin-win-colab-CUDA.txt'
123-
subprocess.run([sys.executable, "-m", "pip", "install", "-r", absolute_path(f"stable_diffusion/{requirements_path}")], check=True, env=environ_copy, cwd=absolute_path("stable_diffusion/"))
120+
requirements_path = 'stable_diffusion/requirements-mac-MPS-CPU.txt'
121+
else: # Use CUDA dependencies by default on Linux/Windows.
122+
# These are not the submodule dependencies from the `development` branch, but use the `main` branch deps for PyTorch 1.11.0.
123+
requirements_path = 'requirements-win-torch-1-11-0.txt'
124+
subprocess.run([sys.executable, "-m", "pip", "install", "-r", absolute_path(requirements_path), "--no-cache-dir"], check=True, env=environ_copy, cwd=absolute_path("stable_diffusion/"))
124125

125126
class InstallDependencies(bpy.types.Operator):
126127
bl_idname = "stable_diffusion.install_dependencies"
@@ -131,6 +132,10 @@ class InstallDependencies(bpy.types.Operator):
131132
bl_options = {"REGISTER", "INTERNAL"}
132133

133134
def execute(self, context):
135+
# Open the console so we can watch the progress.
136+
if sys.platform == 'win32':
137+
bpy.ops.wm.console_toggle()
138+
134139
try:
135140
install_pip()
136141
install_and_import_requirements(requirements_txt=context.scene.dream_textures_requirements_path)

preferences.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ def draw(self, context):
8686

8787
weights_installed = os.path.exists(WEIGHTS_PATH)
8888

89-
warning_box = layout.box()
90-
warning_box.label(text="10GB+ of VRAM is recommended. Smaller images are possible on lower end cards", icon="INFO")
91-
9289
if are_dependencies_installed() and weights_installed:
9390
layout.label(text="Addon setup complete", icon="CHECKMARK")
9491
else:

requirements-win-torch-1-11-0.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
albumentations==0.4.3
2+
einops==0.3.0
3+
huggingface-hub==0.8.1
4+
imageio-ffmpeg==0.4.2
5+
imageio==2.9.0
6+
kornia==0.6.0
7+
# pip will resolve the version which matches torch
8+
numpy
9+
omegaconf==2.1.1
10+
opencv-python==4.6.0.66
11+
pillow==9.2.0
12+
pip>=22
13+
pudb==2019.2
14+
pytorch-lightning==1.4.2
15+
streamlit==1.12.0
16+
# "CompVis/taming-transformers" doesn't work
17+
# ldm\models\autoencoder.py", line 6, in <module>
18+
# from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
19+
# ModuleNotFoundError
20+
taming-transformers-rom1504==0.0.6
21+
test-tube>=0.7.5
22+
torch-fidelity==0.3.0
23+
torchmetrics==0.6.0
24+
transformers==4.19.2
25+
git+https://github.com/openai/CLIP.git@main#egg=clip
26+
git+https://github.com/lstein/k-diffusion.git@master#egg=k-diffusion
27+
git+https://github.com/lstein/GFPGAN@fix-dark-cast-images#egg=gfpgan
28+
# No CUDA in PyPi builds
29+
--extra-index-url https://download.pytorch.org/whl/cu113 --trusted-host https://download.pytorch.org
30+
torch==1.11.0
31+
# Same as numpy - let pip do its thing
32+
torchvision
33+
-e .

stable_diffusion

0 commit comments

Comments
 (0)