maybe fix branch to run offloading

This commit is contained in:
BootsofLagrangian
2024-02-05 22:40:43 +09:00
parent 4295f91dcd
commit 3970bf4080
2 changed files with 8 additions and 0 deletions

View File

@@ -391,6 +391,12 @@ def train(args):
if args.deepspeed:
# Wrapping model for DeepSpeed
import deepspeed
if args.offload_optimizer_device is not None:
accelerator.print('[DeepSpeed] start to manually build cpu_adam.')
deepspeed.ops.op_builder.CPUAdamBuilder().load()
accelerator.print('[DeepSpeed] building cpu_adam done.')
class DeepSpeedModel(torch.nn.Module):
def __init__(self, unet, text_encoder) -> None:
super().__init__()