Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sgm/modules/diffusionmodules/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pytorch_diffusion + derived encoder decoder
import logging
import warnings
import math
from typing import Any, Callable, Optional

Expand Down Expand Up @@ -291,6 +292,13 @@ def make_attn(in_channels, attn_type="vanilla", attn_kwargs=None):
f"as it is too expensive. Please install xformers via e.g. 'pip install xformers==0.0.16'"
)
attn_type = "vanilla-xformers"
if attn_type == "vanilla-xformers" and not XFORMERS_IS_AVAILABLE:
warnings.warn(
f"Requested attention type {attn_type!r} but Xformers is not available; "
f"falling back to vanilla attention"
)
attn_type = "vanilla"
attn_kwargs = None
logpy.info(f"making attention of type '{attn_type}' with {in_channels} in_channels")
if attn_type == "vanilla":
assert attn_kwargs is None
Expand Down