Skip to content

Commit

Permalink
Update run.py
Browse files Browse the repository at this point in the history
Found a few lines in the loading process that are not needed, even slow the model loading process further down. See [issue #32 ](#32) for reference.
  • Loading branch information
IndigoDosSantos authored Mar 18, 2024
1 parent 08185dd commit 4af1cb6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def generate_images(prompt, height, width, negative_prompt, guidance_scale, num_
num_images_per_prompt=int(num_images_per_prompt),
generator=generator,
)
del prior # Explicitly delete the model to help with memory management
torch.cuda.empty_cache() # Clear the CUDA cache to free up unused memory

# Load, use, and discard the decoder model
decoder = load_model("decoder")
Expand All @@ -94,9 +92,7 @@ def generate_images(prompt, height, width, negative_prompt, guidance_scale, num_
output_type="pil",
generator=generator,
).images
del decoder # Explicitly delete the model to help with memory management
torch.cuda.empty_cache() # Clear the CUDA cache to free up unused memory


metadata_embedded = {
"parameters": "Stable Cascade",
"prompt": cleaned_prompt,
Expand Down

0 comments on commit 4af1cb6

Please sign in to comment.