From de7dd8b6aa3aa00ba629c9ba6ce1bc32bd213d2f Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 10 Mar 2023 10:54:08 -0300 Subject: [PATCH] Add comments --- modules/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/models.py b/modules/models.py index f4c1071d..a5ec59d1 100644 --- a/modules/models.py +++ b/modules/models.py @@ -111,6 +111,7 @@ def load_model(model_name): model = load_quant(path_to_model, Path(f"models/{pt_model}"), 4) + # Multi-GPU setup if shared.args.gpu_memory: import accelerate @@ -121,6 +122,8 @@ def load_model(model_name): device_map = accelerate.infer_auto_device_map(model, max_memory=max_memory, no_split_module_classes=["LLaMADecoderLayer"]) model = accelerate.dispatch_model(model, device_map=device_map) + + # Single GPU else: model = model.to(torch.device('cuda:0'))