Skip to content

Commit

Permalink
diffusers version check (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
feifeibear authored Sep 14, 2024
1 parent 2e2ad16 commit 0fed271
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions xfuser/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
HAS_FLASH_ATTN = env_info["has_flash_attn"]


def check_packages():
import diffusers

if not version.parse(diffusers.__version__) > version.parse("0.30.2"):
raise RuntimeError(
"This project requires diffusers version > 0.30.2. Currently, you can not install a correct version of diffusers by pip install."
"Please install it from source code!"
)


def check_env():
# https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/usage/cudagraph.html
if CUDA_VERSION < version.parse("11.3"):
Expand All @@ -31,17 +41,6 @@ def check_env():
"with `pip3 install --pre torch torchvision torchaudio --index-url "
"https://download.pytorch.org/whl/nightly/cu121`"
)
try:
import diffusers

if version.parse(diffusers.__version__) > version.parse("0.30.2"):
raise RuntimeError(
"This project requires diffusers version >= 0.31.0 or above. It is not on pypi. Please install it from source code!"
)
except ImportError:
raise ImportError(
"diffusers is not installed. Please install it with `pip install diffusers`"
)


@dataclass
Expand All @@ -62,6 +61,7 @@ class RuntimeConfig:
use_onediff: bool = False

def __post_init__(self):
check_packages()
if self.use_cuda_graph:
check_env()

Expand Down

0 comments on commit 0fed271

Please sign in to comment.