Update app.py
Browse files
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 |
|