JackAILab commited on
Commit
48713af
1 Parent(s): 0385d4d

Update pipline_StableDiffusion_ConsistentID.py

Browse files
pipline_StableDiffusion_ConsistentID.py CHANGED
@@ -27,6 +27,27 @@ PipelineImageInput = Union[
27
 
28
  ### Download the pretrained model from huggingface and put it locally, then place the model in a local directory and specify the directory location.
29
  class ConsistentIDStableDiffusionPipeline(StableDiffusionPipeline):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  @validate_hf_hub_args
31
  def load_ConsistentID_model(
32
  self,
 
27
 
28
  ### Download the pretrained model from huggingface and put it locally, then place the model in a local directory and specify the directory location.
29
  class ConsistentIDStableDiffusionPipeline(StableDiffusionPipeline):
30
+
31
+ def cuda(self, dtype=torch.float16, use_xformers=False):
32
+ self.to('cuda', dtype)
33
+
34
+ # if hasattr(self, 'image_proj_model'):
35
+ # self.image_proj_model.to(self.unet.device).to(self.unet.dtype)
36
+
37
+ if use_xformers:
38
+ if is_xformers_available():
39
+ import xformers
40
+ from packaging import version
41
+
42
+ xformers_version = version.parse(xformers.__version__)
43
+ if xformers_version == version.parse("0.0.16"):
44
+ logger.warn(
45
+ "xFormers 0.0.16 cannot be used for training in some GPUs. If you observe problems during training, please update xFormers to at least 0.0.17. See https://huggingface.co/docs/diffusers/main/en/optimization/xformers for more details."
46
+ )
47
+ self.enable_xformers_memory_efficient_attention()
48
+ else:
49
+ raise ValueError("xformers is not available. Make sure it is installed correctly")
50
+
51
  @validate_hf_hub_args
52
  def load_ConsistentID_model(
53
  self,