Skip to content

Commit 60be735

Browse files
authored
Switch to regular pytorch channel and restore Python 3.10 for Macs. (CompVis#301)
* Switch to regular pytorch channel and restore Python 3.10 for Macs. Although pytorch-nightly should in theory be faster, it is currently causing increased memory usage and slower iterations: invoke-ai/InvokeAI#283 (comment) This changes the environment-mac.yaml file back to the regular pytorch channel and moves the `transformers` dep into pip for now (since it cannot be satisfied until tokenizers>=0.11 is built for Python 3.10). * Specify versions for Pip packages as well.
1 parent d0d95d3 commit 60be735

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

README-Mac-MPS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,20 @@ something that depends on it-- Rosetta can translate some Intel instructions but
320320
not the specialized ones here. To avoid this, make sure to use the environment
321321
variable `CONDA_SUBDIR=osx-arm64`, which restricts the Conda environment to only
322322
use ARM packages, and use `nomkl` as described above.
323+
324+
### input types 'tensor<2x1280xf32>' and 'tensor<*xf16>' are not broadcast compatible
325+
326+
May appear when just starting to generate, e.g.:
327+
328+
```
329+
dream> clouds
330+
Generating: 0%| | 0/1 [00:00<?, ?it/s]/Users/[...]/dev/stable-diffusion/ldm/modules/embedding_manager.py:152: UserWarning: The operator 'aten::nonzero' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/_temp/anaconda/conda-bld/pytorch_1662016319283/work/aten/src/ATen/mps/MPSFallback.mm:11.)
331+
placeholder_idx = torch.where(
332+
loc("mps_add"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/20d6c351-ee94-11ec-bcaf-7247572f23b4/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":219:0)): error: input types 'tensor<2x1280xf32>' and 'tensor<*xf16>' are not broadcast compatible
333+
LLVM ERROR: Failed to infer result type(s).
334+
Abort trap: 6
335+
/Users/[...]/opt/anaconda3/envs/ldm/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
336+
warnings.warn('resource_tracker: There appear to be %d '
337+
```
338+
339+
Macs do not support autocast/mixed-precision. Supply `--full_precision` to use float32 everywhere.

environment-mac.yaml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
name: ldm
22
channels:
3-
- pytorch-nightly
3+
- pytorch
44
- conda-forge
55
dependencies:
6-
- python==3.9.13
6+
- python==3.10.5
77
- pip==22.2.2
88

9-
# pytorch-nightly, left unpinned
9+
# pytorch left unpinned
1010
- pytorch
11-
- torchmetrics
1211
- torchvision
1312

1413
# I suggest to keep the other deps sorted for convenience.
15-
# If you wish to upgrade to 3.10, try to run this:
14+
# To determine what the latest versions should be, run:
1615
#
1716
# ```shell
18-
# CONDA_CMD=conda
19-
# sed -E 's/python==3.9.13/python==3.10.5/;s/ldm/ldm-3.10/;21,99s/- ([^=]+)==.+/- \1/' environment-mac.yaml > /tmp/environment-mac-updated.yml
20-
# CONDA_SUBDIR=osx-arm64 $CONDA_CMD env create -f /tmp/environment-mac-updated.yml && $CONDA_CMD list -n ldm-3.10 | awk ' {print " - " $1 "==" $2;} '
17+
# sed -E 's/ldm/ldm-updated/;20,99s/- ([^=]+)==.+/- \1/' environment-mac.yaml > environment-mac-updated.yml
18+
# CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac-updated.yml && conda list -n ldm-updated | awk ' {print " - " $1 "==" $2;} '
2119
# ```
22-
#
23-
# Unfortunately, as of 2022-08-31, this fails at the pip stage.
2420
- albumentations==1.2.1
2521
- coloredlogs==15.0.1
2622
- einops==0.4.1
2723
- grpcio==1.46.4
28-
- humanfriendly
29-
- imageio-ffmpeg==0.4.7
24+
- humanfriendly==10.0
3025
- imageio==2.21.2
26+
- imageio-ffmpeg==0.4.7
3127
- imgaug==0.4.0
3228
- kornia==0.6.7
3329
- mpmath==1.2.1
@@ -43,13 +39,11 @@ dependencies:
4339
- streamlit==1.12.2
4440
- sympy==1.10.1
4541
- tensorboard==2.9.0
46-
- transformers==4.21.2
42+
- torchmetrics==0.9.3
4743
- pip:
48-
- invisible-watermark
49-
- test-tube
50-
- tokenizers
51-
- torch-fidelity
52-
- -e git+https://github.com/huggingface/[email protected]#egg=diffusers
44+
- test-tube==0.7.5
45+
- transformers==4.21.2
46+
- torch-fidelity==0.3.0
5347
- -e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers
5448
- -e git+https://github.com/openai/CLIP.git@main#egg=clip
5549
- -e git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k_diffusion

0 commit comments

Comments
 (0)