DonImages commited on
Commit
9ea4f44
·
verified ·
1 Parent(s): 24d7276

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -24,10 +24,12 @@ lora_model_path = "./lora_model.pth" # Assuming the file is saved locally
24
 
25
  # Custom method to load and apply LoRA weights to the Stable Diffusion pipeline
26
  def load_lora_model(pipe, lora_model_path):
 
 
 
27
  # When loading the LoRA weights
28
  lora_weights = torch.load(lora_model_path, map_location=device, weights_only=True)
29
 
30
-
31
  # Print available attributes of the model to check access to `unet` (optional)
32
  print(dir(pipe)) # This will list all attributes and methods of the `pipe` object
33
 
 
24
 
25
  # Custom method to load and apply LoRA weights to the Stable Diffusion pipeline
26
  def load_lora_model(pipe, lora_model_path):
27
+ # Set device to 'cuda' if available, otherwise 'cpu'
28
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
29
+
30
  # When loading the LoRA weights
31
  lora_weights = torch.load(lora_model_path, map_location=device, weights_only=True)
32
 
 
33
  # Print available attributes of the model to check access to `unet` (optional)
34
  print(dir(pipe)) # This will list all attributes and methods of the `pipe` object
35