File size: 27,930 Bytes
4bacd0b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
epoch 1/10
Traceback (most recent call last):
File "/workspace/kohya_ss/./sdxl_train_network.py", line 176, in <module>
trainer.train(args)
File "/workspace/kohya_ss/train_network.py", line 773, in train
noise_pred = self.call_unet(
File "/workspace/kohya_ss/./sdxl_train_network.py", line 156, in call_unet
noise_pred = unet(noisy_latents, timesteps, text_embedding, vector_embedding)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/accelerate/utils/operations.py", line 521, in forward
return model_forward(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/accelerate/utils/operations.py", line 509, in __call__
return convert_to_fp32(self.model_forward(*args, **kwargs))
File "/usr/local/lib/python3.10/dist-packages/torch/amp/autocast_mode.py", line 14, in decorate_autocast
return func(*args, **kwargs)
File "/workspace/kohya_ss/library/sdxl_original_unet.py", line 1088, in forward
h = call_module(module, h, emb, context)
File "/workspace/kohya_ss/library/sdxl_original_unet.py", line 1071, in call_module
x = layer(x, emb)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/kohya_ss/library/sdxl_original_unet.py", line 328, in forward
x = self.forward_body(x, emb)
File "/workspace/kohya_ss/library/sdxl_original_unet.py", line 309, in forward_body
h = self.in_layers(x)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/container.py", line 217, in forward
input = module(input)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/kohya_ss/library/sdxl_original_unet.py", line 272, in forward
return super().forward(x)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/normalization.py", line 273, in forward
return F.group_norm(
File "/usr/local/lib/python3.10/dist-packages/torch/nn/functional.py", line 2530, in group_norm
return torch.group_norm(input, num_groups, weight, bias, eps, torch.backends.cudnn.enabled)
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 40.00 MiB (GPU 0; 19.71 GiB total capacity; 17.84 GiB already allocated; 6.62 MiB free; 18.10 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
[31mโญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ [39m[1mTraceback (most recent call last)[31m[22m โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
[31mโ[39m /workspace/kohya_ss/./[1msdxl_train_network.py[22m:[94m176[39m in [92m<module>[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 173 โ args = train_util.read_config_from_file(args, parser) [31mโ
[31mโ[39m 174 โ [31mโ
[31mโ[39m 175 โ trainer = SdxlNetworkTrainer() [31mโ
[31mโ[39m [31mโฑ [39m176 โ trainer.train(args) [31mโ
[31mโ[39m 177 [31mโ
[31mโ[39m [31mโ
[31mโ[39m /workspace/kohya_ss/[1mtrain_network.py[22m:[94m773[39m in [92mtrain[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 770 โ โ โ โ โ [31mโ
[31mโ[39m 771 โ โ โ โ โ # Predict the noise residual [31mโ
[31mโ[39m 772 โ โ โ โ โ [94mwith[39m accelerator.autocast(): [31mโ
[31mโ[39m [31mโฑ [39m773 โ โ โ โ โ โ noise_pred = [96mself[39m.call_unet( [31mโ
[31mโ[39m 774 โ โ โ โ โ โ โ args, accelerator, unet, noisy_latents, timesteps, text_enco [31mโ
[31mโ[39m 775 โ โ โ โ โ โ ) [31mโ
[31mโ[39m 776 [31mโ
[31mโ[39m [31mโ
[31mโ[39m /workspace/kohya_ss/./[1msdxl_train_network.py[22m:[94m156[39m in [92mcall_unet[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 153 โ โ vector_embedding = torch.cat([pool2, embs], dim=[94m1[39m).to(weight_dtype) [31mโ
[31mโ[39m 154 โ โ text_embedding = torch.cat([encoder_hidden_states1, encoder_hidden_states2], dim [31mโ
[31mโ[39m 155 โ โ [31mโ
[31mโ[39m [31mโฑ [39m156 โ โ noise_pred = unet(noisy_latents, timesteps, text_embedding, vector_embedding) [31mโ
[31mโ[39m 157 โ โ [94mreturn[39m noise_pred [31mโ
[31mโ[39m 158 โ [31mโ
[31mโ[39m 159 โ [94mdef[39m [92msample_images[39m([96mself[39m, accelerator, args, epoch, global_step, device, vae, tokenize [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/nn/modules/[1mmodule.py[22m:[94m1501[39m in [92m_call_impl[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 1498 โ โ [94mif[39m [95mnot[39m ([96mself[39m._backward_hooks [95mor[39m [96mself[39m._backward_pre_hooks [95mor[39m [96mself[39m._forward_hooks [31mโ
[31mโ[39m 1499 โ โ โ โ [95mor[39m _global_backward_pre_hooks [95mor[39m _global_backward_hooks [31mโ
[31mโ[39m 1500 โ โ โ โ [95mor[39m _global_forward_hooks [95mor[39m _global_forward_pre_hooks): [31mโ
[31mโ[39m [31mโฑ [39m1501 โ โ โ [94mreturn[39m forward_call(*args, **kwargs) [31mโ
[31mโ[39m 1502 โ โ # Do not call functions when jit is used [31mโ
[31mโ[39m 1503 โ โ full_backward_hooks, non_full_backward_hooks = [], [] [31mโ
[31mโ[39m 1504 โ โ backward_pre_hooks = [] [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/accelerate/utils/[1moperations.py[22m:[94m521[39m in [92mforward[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 518 โ model_forward = ConvertOutputsToFp32(model_forward) [31mโ
[31mโ[39m 519 โ [31mโ
[31mโ[39m 520 โ [94mdef[39m [92mforward[39m(*args, **kwargs): [31mโ
[31mโ[39m [31mโฑ [39m521 โ โ [94mreturn[39m model_forward(*args, **kwargs) [31mโ
[31mโ[39m 522 โ [31mโ
[31mโ[39m 523 โ # To act like a decorator so that it can be popped when doing `extract_model_from_pa [31mโ
[31mโ[39m 524 โ forward.__wrapped__ = model_forward [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/accelerate/utils/[1moperations.py[22m:[94m509[39m in [92m__call__[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 506 โ โ update_wrapper([96mself[39m, model_forward) [31mโ
[31mโ[39m 507 โ [31mโ
[31mโ[39m 508 โ [94mdef[39m [92m__call__[39m([96mself[39m, *args, **kwargs): [31mโ
[31mโ[39m [31mโฑ [39m509 โ โ [94mreturn[39m convert_to_fp32([96mself[39m.model_forward(*args, **kwargs)) [31mโ
[31mโ[39m 510 โ [31mโ
[31mโ[39m 511 โ [94mdef[39m [92m__getstate__[39m([96mself[39m): [31mโ
[31mโ[39m 512 โ โ [94mraise[39m pickle.PicklingError( [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/amp/[1mautocast_mode.py[22m:[94m14[39m in [92mdecorate_autocast[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 11 โ [1m@functools[22m.wraps(func) [31mโ
[31mโ[39m 12 โ [94mdef[39m [92mdecorate_autocast[39m(*args, **kwargs): [31mโ
[31mโ[39m 13 โ โ [94mwith[39m autocast_instance: [31mโ
[31mโ[39m [31mโฑ [39m 14 โ โ โ [94mreturn[39m func(*args, **kwargs) [31mโ
[31mโ[39m 15 โ decorate_autocast.__script_unsupported = [33m'@autocast() decorator is not supported in [39m [31mโ
[31mโ[39m 16 โ [94mreturn[39m decorate_autocast [31mโ
[31mโ[39m 17 [31mโ
[31mโ[39m [31mโ
[31mโ[39m /workspace/kohya_ss/library/[1msdxl_original_unet.py[22m:[94m1088[39m in [92mforward[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 1085 โ โ [31mโ
[31mโ[39m 1086 โ โ [94mfor[39m module [95min[39m [96mself[39m.output_blocks: [31mโ
[31mโ[39m 1087 โ โ โ h = torch.cat([h, hs.pop()], dim=[94m1[39m) [31mโ
[31mโ[39m [31mโฑ [39m1088 โ โ โ h = call_module(module, h, emb, context) [31mโ
[31mโ[39m 1089 โ โ [31mโ
[31mโ[39m 1090 โ โ h = h.type(x.dtype) [31mโ
[31mโ[39m 1091 โ โ h = call_module([96mself[39m.out, h, emb, context) [31mโ
[31mโ[39m [31mโ
[31mโ[39m /workspace/kohya_ss/library/[1msdxl_original_unet.py[22m:[94m1071[39m in [92mcall_module[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 1068 โ โ โ [94mfor[39m layer [95min[39m module: [31mโ
[31mโ[39m 1069 โ โ โ โ # print(layer.__class__.__name__, x.dtype, emb.dtype, context.dtype if c [31mโ
[31mโ[39m 1070 โ โ โ โ [94mif[39m [96misinstance[39m(layer, ResnetBlock2D): [31mโ
[31mโ[39m [31mโฑ [39m1071 โ โ โ โ โ x = layer(x, emb) [31mโ
[31mโ[39m 1072 โ โ โ โ [94melif[39m [96misinstance[39m(layer, Transformer2DModel): [31mโ
[31mโ[39m 1073 โ โ โ โ โ x = layer(x, context) [31mโ
[31mโ[39m 1074 โ โ โ โ [94melse[39m: [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/nn/modules/[1mmodule.py[22m:[94m1501[39m in [92m_call_impl[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 1498 โ โ [94mif[39m [95mnot[39m ([96mself[39m._backward_hooks [95mor[39m [96mself[39m._backward_pre_hooks [95mor[39m [96mself[39m._forward_hooks [31mโ
[31mโ[39m 1499 โ โ โ โ [95mor[39m _global_backward_pre_hooks [95mor[39m _global_backward_hooks [31mโ
[31mโ[39m 1500 โ โ โ โ [95mor[39m _global_forward_hooks [95mor[39m _global_forward_pre_hooks): [31mโ
[31mโ[39m [31mโฑ [39m1501 โ โ โ [94mreturn[39m forward_call(*args, **kwargs) [31mโ
[31mโ[39m 1502 โ โ # Do not call functions when jit is used [31mโ
[31mโ[39m 1503 โ โ full_backward_hooks, non_full_backward_hooks = [], [] [31mโ
[31mโ[39m 1504 โ โ backward_pre_hooks = [] [31mโ
[31mโ[39m [31mโ
[31mโ[39m /workspace/kohya_ss/library/[1msdxl_original_unet.py[22m:[94m328[39m in [92mforward[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 325 โ โ โ [31mโ
[31mโ[39m 326 โ โ โ x = torch.utils.checkpoint.checkpoint(create_custom_forward([96mself[39m.forward_bod [31mโ
[31mโ[39m 327 โ โ [94melse[39m: [31mโ
[31mโ[39m [31mโฑ [39m 328 โ โ โ x = [96mself[39m.forward_body(x, emb) [31mโ
[31mโ[39m 329 โ โ [31mโ
[31mโ[39m 330 โ โ [94mreturn[39m x [31mโ
[31mโ[39m 331 [31mโ
[31mโ[39m [31mโ
[31mโ[39m /workspace/kohya_ss/library/[1msdxl_original_unet.py[22m:[94m309[39m in [92mforward_body[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 306 โ โ [96mself[39m.gradient_checkpointing = [94mFalse[39m [31mโ
[31mโ[39m 307 โ [31mโ
[31mโ[39m 308 โ [94mdef[39m [92mforward_body[39m([96mself[39m, x, emb): [31mโ
[31mโ[39m [31mโฑ [39m 309 โ โ h = [96mself[39m.in_layers(x) [31mโ
[31mโ[39m 310 โ โ emb_out = [96mself[39m.emb_layers(emb).type(h.dtype) [31mโ
[31mโ[39m 311 โ โ h = h + emb_out[:, :, [94mNone[39m, [94mNone[39m] [31mโ
[31mโ[39m 312 โ โ h = [96mself[39m.out_layers(h) [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/nn/modules/[1mmodule.py[22m:[94m1501[39m in [92m_call_impl[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 1498 โ โ [94mif[39m [95mnot[39m ([96mself[39m._backward_hooks [95mor[39m [96mself[39m._backward_pre_hooks [95mor[39m [96mself[39m._forward_hooks [31mโ
[31mโ[39m 1499 โ โ โ โ [95mor[39m _global_backward_pre_hooks [95mor[39m _global_backward_hooks [31mโ
[31mโ[39m 1500 โ โ โ โ [95mor[39m _global_forward_hooks [95mor[39m _global_forward_pre_hooks): [31mโ
[31mโ[39m [31mโฑ [39m1501 โ โ โ [94mreturn[39m forward_call(*args, **kwargs) [31mโ
[31mโ[39m 1502 โ โ # Do not call functions when jit is used [31mโ
[31mโ[39m 1503 โ โ full_backward_hooks, non_full_backward_hooks = [], [] [31mโ
[31mโ[39m 1504 โ โ backward_pre_hooks = [] [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/nn/modules/[1mcontainer.py[22m:[94m217[39m in [92mforward[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 214 โ # with Any as TorchScript expects a more precise type [31mโ
[31mโ[39m 215 โ [94mdef[39m [92mforward[39m([96mself[39m, [96minput[39m): [31mโ
[31mโ[39m 216 โ โ [94mfor[39m module [95min[39m [96mself[39m: [31mโ
[31mโ[39m [31mโฑ [39m217 โ โ โ [96minput[39m = module([96minput[39m) [31mโ
[31mโ[39m 218 โ โ [94mreturn[39m [96minput[39m [31mโ
[31mโ[39m 219 โ [31mโ
[31mโ[39m 220 โ [94mdef[39m [92mappend[39m([96mself[39m, module: Module) -> [33m'Sequential'[39m: [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/nn/modules/[1mmodule.py[22m:[94m1501[39m in [92m_call_impl[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 1498 โ โ [94mif[39m [95mnot[39m ([96mself[39m._backward_hooks [95mor[39m [96mself[39m._backward_pre_hooks [95mor[39m [96mself[39m._forward_hooks [31mโ
[31mโ[39m 1499 โ โ โ โ [95mor[39m _global_backward_pre_hooks [95mor[39m _global_backward_hooks [31mโ
[31mโ[39m 1500 โ โ โ โ [95mor[39m _global_forward_hooks [95mor[39m _global_forward_pre_hooks): [31mโ
[31mโ[39m [31mโฑ [39m1501 โ โ โ [94mreturn[39m forward_call(*args, **kwargs) [31mโ
[31mโ[39m 1502 โ โ # Do not call functions when jit is used [31mโ
[31mโ[39m 1503 โ โ full_backward_hooks, non_full_backward_hooks = [], [] [31mโ
[31mโ[39m 1504 โ โ backward_pre_hooks = [] [31mโ
[31mโ[39m [31mโ
[31mโ[39m /workspace/kohya_ss/library/[1msdxl_original_unet.py[22m:[94m272[39m in [92mforward[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 269 [94mclass[39m [4mGroupNorm32[24m(nn.GroupNorm): [31mโ
[31mโ[39m 270 โ [94mdef[39m [92mforward[39m([96mself[39m, x): [31mโ
[31mโ[39m 271 โ โ [94mif[39m [96mself[39m.weight.dtype != torch.float32: [31mโ
[31mโ[39m [31mโฑ [39m 272 โ โ โ [94mreturn[39m [96msuper[39m().forward(x) [31mโ
[31mโ[39m 273 โ โ [94mreturn[39m [96msuper[39m().forward(x.float()).type(x.dtype) [31mโ
[31mโ[39m 274 [31mโ
[31mโ[39m 275 [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/nn/modules/[1mnormalization.py[22m:[94m273[39m in [92mforward[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 270 โ โ โ init.zeros_([96mself[39m.bias) [31mโ
[31mโ[39m 271 โ [31mโ
[31mโ[39m 272 โ [94mdef[39m [92mforward[39m([96mself[39m, [96minput[39m: Tensor) -> Tensor: [31mโ
[31mโ[39m [31mโฑ [39m273 โ โ [94mreturn[39m F.group_norm( [31mโ
[31mโ[39m 274 โ โ โ [96minput[39m, [96mself[39m.num_groups, [96mself[39m.weight, [96mself[39m.bias, [96mself[39m.eps) [31mโ
[31mโ[39m 275 โ [31mโ
[31mโ[39m 276 โ [94mdef[39m [92mextra_repr[39m([96mself[39m) -> [96mstr[39m: [31mโ
[31mโ[39m [31mโ
[31mโ[39m /usr/local/lib/python3.10/dist-packages/torch/nn/[1mfunctional.py[22m:[94m2530[39m in [92mgroup_norm[39m [31mโ
[31mโ[39m [31mโ
[31mโ[39m 2527 โ [94mif[39m [96minput[39m.dim() < [94m2[39m: [31mโ
[31mโ[39m 2528 โ โ [94mraise[39m [96mRuntimeError[39m([33mf"Expected at least 2 dimensions for input tensor but receive[39m [31mโ
[31mโ[39m 2529 โ _verify_batch_size([[96minput[39m.size([94m0[39m) * [96minput[39m.size([94m1[39m) // num_groups, num_groups] + [96mlist[39m( [31mโ
[31mโ[39m [31mโฑ [39m2530 โ [94mreturn[39m torch.group_norm([96minput[39m, num_groups, weight, bias, eps, torch.backends.cudnn.e [31mโ
[31mโ[39m 2531 [31mโ
[31mโ[39m 2532 [31mโ
[31mโ[39m 2533 [94mdef[39m [92mlocal_response_norm[39m([96minput[39m: Tensor, size: [96mint[39m, alpha: [96mfloat[39m = [94m1e-4[39m, beta: [96mfloat[39m = [94m0.7[39m [31mโ
[31mโฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
[1mOutOfMemoryError: [22mCUDA out of memory. Tried to allocate [1m40.00[22m MiB [1m([22mGPU [1m0[22m; [1m19.71[22m GiB total capacity; [1m17.84[22m GiB already allocated; [1m6.62[22m MiB free; [1m18.10[22m GiB reserved in total by PyTorch[1m)[22m If reserved
memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF |