Skip to content

Commit

Permalink
[enhancement] Print status message at startup when xformers is availa…
Browse files Browse the repository at this point in the history
…ble (#2461)
  • Loading branch information
keturn authored Feb 1, 2023
2 parents bd57793 + abd972f commit 6608343
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ldm/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import transformers
from PIL import Image, ImageOps
from diffusers.pipeline_utils import DiffusionPipeline
from diffusers.utils.import_utils import is_xformers_available
from omegaconf import OmegaConf
from pytorch_lightning import seed_everything, logging

Expand Down Expand Up @@ -203,6 +204,14 @@ def __init__(
self.precision = choose_precision(self.device)
Globals.full_precision = self.precision=='float32'

if is_xformers_available():
if not Globals.disable_xformers:
print('>> xformers memory-efficient attention is available and enabled')
else:
print('>> xformers memory-efficient attention is available but disabled')
else:
print('>> xformers not installed')

# model caching system for fast switching
self.model_manager = ModelManager(mconfig,self.device,self.precision,max_loaded_models=max_loaded_models)
# don't accept invalid models
Expand Down

0 comments on commit 6608343

Please sign in to comment.