Skip to content

Commit

Permalink
Update initialization.py
Browse files Browse the repository at this point in the history
initialization

initialization

Update initialization.py
  • Loading branch information
lllyasviel committed Jan 14, 2024
1 parent 7cb6178 commit 2af39f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def imports():
logging.getLogger("torch.distributed.nn").setLevel(logging.ERROR) # sshh...
logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage())

from modules_forge.initialization import initialize_forge
initialize_forge()
startup_timer.record("initialize forge")

import torch # noqa: F401
startup_timer.record("import torch")
import pytorch_lightning # noqa: F401
Expand Down
14 changes: 14 additions & 0 deletions modules_forge/initialization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


def initialize_forge():
import ldm_patched.modules.args_parser as args_parser

args_parser.args = args_parser.parser.parse_args([])

import ldm_patched.modules.model_management as model_management
import torch

device = model_management.get_torch_device()
torch.zeros((1, 1)).to(device, torch.float32)
model_management.soft_empty_cache()
return

0 comments on commit 2af39f1

Please sign in to comment.