Skip to content

Instantly share code, notes, and snippets.

@rbourgeat
Created January 30, 2024 23:08
Show Gist options
  • Save rbourgeat/9b7523d412a6eaf0cafbd91827a61454 to your computer and use it in GitHub Desktop.
Save rbourgeat/9b7523d412a6eaf0cafbd91827a61454 to your computer and use it in GitHub Desktop.
ml-stable-diffusion-sdxl-turbo.logs
(coreml_stable_diffusion) ➜ ml-stable-diffusion git:(main) python -m python_coreml_stable_diffusion.torch2coreml --convert-unet --convert-text-encoder --convert-vae-decoder --convert-safety-checker --model-version stabilityai/sdxl-turbo -o sdxl
scikit-learn version 1.3.2 is not supported. Minimum required version: 0.17. Maximum required version: 1.1.2. Disabling scikit-learn conversion API.
Torch version 2.2.0 has not been tested with coremltools. You may run into unexpected errors. Torch 2.1.0 is the most recent version that has been tested.
/Users/rbourgeat/miniforge3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
torch.utils._pytree._register_pytree_node(
INFO:__main__:Initializing DiffusionPipeline with stabilityai/sdxl-turbo..
Fetching 18 files: 100%|█████████████████████████████████████████████████████████████████████████████████████| 18/18 [00:00<00:00, 39.42it/s]
Keyword arguments {'use_auth_token': True} are not expected by StableDiffusionXLPipeline and will be ignored.
Loading pipeline components...: 100%|██████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 9.65it/s]
INFO:__main__:Done. Pipeline in effect: StableDiffusionXLPipeline
INFO:__main__:Attention implementation in effect: AttentionImplementations.SPLIT_EINSUM
INFO:__main__:Converting vae_decoder
/Users/rbourgeat/miniforge3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/diffusers/models/upsampling.py:149: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert hidden_states.shape[1] == self.channels
/Users/rbourgeat/miniforge3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/diffusers/models/upsampling.py:165: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if hidden_states.shape[0] >= 64:
/Users/rbourgeat/miniforge3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/coremltools/models/_deprecation.py:27: FutureWarning: Function _TORCH_OPS_REGISTRY.__contains__ is deprecated and will be removed in 7.2.; Please use coremltools.converters.mil.frontend.torch.register_torch_op
warnings.warn(msg, category=FutureWarning)
/Users/rbourgeat/miniforge3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/coremltools/models/_deprecation.py:27: FutureWarning: Function _TORCH_OPS_REGISTRY.__delitem__ is deprecated and will be removed in 7.2.; Please use coremltools.converters.mil.frontend.torch.register_torch_op
warnings.warn(msg, category=FutureWarning)
INFO:__main__:Converting vae_decoder to CoreML..
Converting PyTorch Frontend ==> MIL Ops: 100%|████████████████████████████████████████████████████████▊| 368/369 [00:00<00:00, 2925.44 ops/s]
Running MIL frontend_pytorch pipeline: 100%|█████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 284.09 passes/s]
Running MIL default pipeline: 100%|█████████████████████████████████████████████████████████████████████| 71/71 [00:04<00:00, 16.63 passes/s]
Running MIL backend_mlprogram pipeline: 100%|██████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 380.72 passes/s]
INFO:__main__:Saved vae_decoder into sdxl/Stable_Diffusion_version_stabilityai_sdxl-turbo_vae_decoder.mlpackage
INFO:__main__:Converted vae_decoder
INFO:__main__:Converting unet
WARNING:python_coreml_stable_diffusion.unet:`use_linear_projection=True` is ignored!
INFO:__main__:Sample UNet inputs spec: {'sample': (torch.Size([2, 4, 64, 64]), torch.float32), 'timestep': (torch.Size([2]), torch.float32), 'encoder_hidden_states': (torch.Size([2, 2048, 1, 77]), torch.float32)}
INFO:__main__:JIT tracing..
/Users/rbourgeat/Projets Perso/ml-stable-diffusion/python_coreml_stable_diffusion/layer_norm.py:61: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert inputs.size(1) == self.num_channels
INFO:__main__:Done.
INFO:__main__:Converting unet to CoreML..
WARNING:coremltools:Tuple detected at graph output. This will be flattened in the converted model.
Converting PyTorch Frontend ==> MIL Ops: 0%| | 0/58082 [00:00<?, ? ops/s]WARNING:coremltools:Saving value type of int64 into a builtin type of int32, might lose precision!
Converting PyTorch Frontend ==> MIL Ops: 34%|█████████████████▉ | 19699/58082 [00:05<00:23, 162Converting PyTorch Frontend ==> MIL Ops: 48%|█████████████████████████▌ | 28077/58082 [00:08<00:11, 261Converting PyTorch Frontend ==> MIL Ops: 49%|█████████████████████████▉ | 28422/58082 [00:08<00:10, 282Converting PyTorch Frontend ==> MIL Ops: 49%|██████████████████████████▏ | 28717/58082 [00:09<00:18, 158Converting PyTorch Frontend ==> MIL Ops: 50%|██████████████████████████▌ | 29073/58082 [00:09<00:15, 189Converting PyTorch Frontend ==> MIL Ops: 51%|██████████████████████████▉ | 29491/58082 [00:09<00:12, 233Converting PyTorch Frontend ==> MIL Ops: 52%|███████████████████████████▎ | 29924/58082 [00:09<00:10, 274Converting PyTorch Frontend ==> MIL Ops: 52%|███████████████████████████▋ | 30331/58082 [00:09<00:09, 300Converting PyTorch Frontend ==> MIL Ops: 53%|███████████████████████████▉ | 30680/58082 [00:09<00:09, 300Converting PyTorch Frontend ==> MIL Ops: 53%|████████████████████████████▎ | 31014/58082 [00:09<00:09, 300Converting PyTorch Frontend ==> MIL Ops: 54%|████████████████████████████▌ | 31339/58082 [00:09<00:09, 279Converting PyTorch Frontend ==> MIL Ops: 55%|████████████████████████████▉ | 31683/58082 [00:10<00:09, 286Converting PyTorch Frontend ==> MIL Ops: 55%|█████████████████████████████▎ | 32101/58082 [00:10<00:08, 309Converting PyTorch Frontend ==> MIL Ops: 56%|█████████████████████████████▋ | 32521/58082 [00:10<00:07, 328Converting PyTorch Frontend ==> MIL Ops: 57%|██████████████████████████████ | 32885/58082 [00:10<00:07, 337Converting PyTorch Frontend ==> MIL Ops: 57%|██████████████████████████████▎ | 33230/58082 [00:10<00:08, 298Converting PyTorch Frontend ==> MIL Ops: 58%|██████████████████████████████▌ | 33541/58082 [00:10<00:08, 283Converting PyTorch Frontend ==> MIL Ops: 58%|██████████████████████████████▊ | 33833/58082 [00:10<00:08, 283Converting PyTorch Frontend ==> MIL Ops: 59%|███████████████████████████████▏ | 34197/58082 [00:10<00:07, 304Converting PyTorch Frontend ==> MIL Ops: 59%|███████████████████████████████▍ | 34509/58082 [00:10<00:08, 278Converting PyTorch Frontend ==> MIL Ops: 60%|███████████████████████████████▊ | 34796/58082 [00:11<00:09, 235Converting PyTorch Frontend ==> MIL Ops: 61%|████████████████████████████████ | 35147/58082 [00:11<00:08, 260Converting PyTorch Frontend ==> MIL Ops: 61%|████████████████████████████████▍ | 35501/58082 [00:11<00:07, 283Converting PyTorch Frontend ==> MIL Ops: 62%|████████████████████████████████▋ | 35800/58082 [00:11<00:09, 243Converting PyTorch Frontend ==> MIL Ops: 62%|████████████████████████████████▉ | 36062/58082 [00:11<00:09, 223Converting PyTorch Frontend ==> MIL Ops: 63%|█████████████████████████████████▏ | 36437/58082 [00:11<00:08, 255Converting PyTorch Frontend ==> MIL Ops: 63%|█████████████████████████████████▍ | 36708/58082 [00:11<00:08, 248Converting PyTorch Frontend ==> MIL Ops: 64%|█████████████████████████████████▋ | 36967/58082 [00:12<00:13, 151Converting PyTorch Frontend ==> MIL Ops: 64%|██████████████████████████████████ | 37294/58082 [00:12<00:11, 182Converting PyTorch Frontend ==> MIL Ops: 65%|██████████████████████████████████▏ | 37534/58082 [00:12<00:16, 124Converting PyTorch Frontend ==> MIL Ops: 65%|██████████████████████████████████▍ | 37807/58082 [00:12<00:13, 146Converting PyTorch Frontend ==> MIL Ops: 66%|██████████████████████████████████▊ | 38148/58082 [00:12<00:10, 181Converting PyTorch Frontend ==> MIL Ops: 66%|███████████████████████████████████ | 38394/58082 [00:13<00:12, 157Converting PyTorch Frontend ==> MIL Ops: 67%|███████████████████████████████████▎ | 38674/58082 [00:13<00:10, 181Converting PyTorch Frontend ==> MIL Ops: 67%|███████████████████████████████████▌ | 38923/58082 [00:13<00:09, 195Converting PyTorch Frontend ==> MIL Ops: 67%|███████████████████████████████████▋ | 39158/58082 [00:13<00:11, 163Converting PyTorch Frontend ==> MIL Ops: 68%|████████████████████████████████████ | 39534/58082 [00:13<00:08, 206Converting PyTorch Frontend ==> MIL Ops: 68%|████████████████████████████████████▎ | 39780/58082 [00:13<00:08, 213Converting PyTorch Frontend ==> MIL Ops: 69%|████████████████████████████████████▌ | 40023/58082 [00:13<00:10, 169Converting PyTorch Frontend ==> MIL Ops: 70%|████████████████████████████████████▊ | 40404/58082 [00:14<00:08, 207Converting PyTorch Frontend ==> MIL Ops: 70%|█████████████████████████████████████ | 40645/58082 [00:14<00:08, 211Converting PyTorch Frontend ==> MIL Ops: 70%|█████████████████████████████████████▎ | 40881/58082 [00:14<00:10, 165Converting PyTorch Frontend ==> MIL Ops: 71%|█████████████████████████████████████▋ | 41255/58082 [00:14<00:08, 208Converting PyTorch Frontend ==> MIL Ops: 71%|█████████████████████████████████████▊ | 41505/58082 [00:14<00:08, 202Converting PyTorch Frontend ==> MIL Ops: 72%|██████████████████████████████████████ | 41736/58082 [00:14<00:09, 178Converting PyTorch Frontend ==> MIL Ops: 72%|██████████████████████████████████████▍ | 42080/58082 [00:14<00:07, 214Converting PyTorch Frontend ==> MIL Ops: 73%|██████████████████████████████████████▌ | 42323/58082 [00:15<00:08, 177Converting PyTorch Frontend ==> MIL Ops: 73%|██████████████████████████████████████▊ | 42564/58082 [00:15<00:08, 183Converting PyTorch Frontend ==> MIL Ops: 74%|███████████████████████████████████████ | 42769/58082 [00:15<00:09, 162Converting PyTorch Frontend ==> MIL Ops: 74%|███████████████████████████████████████▎ | 43014/58082 [00:15<00:08, 171Converting PyTorch Frontend ==> MIL Ops: 74%|███████████████████████████████████████▍ | 43200/58082 [00:15<00:09, 164Converting PyTorch Frontend ==> MIL Ops: 75%|███████████████████████████████████████▋ | 43434/58082 [00:15<00:08, 174Converting PyTorch Frontend ==> MIL Ops: 75%|███████████████████████████████████████▊ | 43617/58082 [00:15<00:09, 148Converting PyTorch Frontend ==> MIL Ops: 76%|████████████████████████████████████████ | 43879/58082 [00:16<00:08, 173Converting PyTorch Frontend ==> MIL Ops: 76%|████████████████████████████████████████▏ | 44067/58082 [00:16<00:08, 157Converting PyTorch Frontend ==> MIL Ops: 76%|████████████████████████████████████████▍ | 44300/58082 [00:16<00:07, 175Converting PyTorch Frontend ==> MIL Ops: 77%|████████████████████████████████████████▌ | 44488/58082 [00:16<00:09, 137Converting PyTorch Frontend ==> MIL Ops: 77%|████████████████████████████████████████▊ | 44742/58082 [00:16<00:08, 162Converting PyTorch Frontend ==> MIL Ops: 77%|████████████████████████████████████████▉ | 44929/58082 [00:16<00:08, 149Converting PyTorch Frontend ==> MIL Ops: 78%|█████████████████████████████████████████▏ | 45172/58082 [00:16<00:07, 171Converting PyTorch Frontend ==> MIL Ops: 78%|█████████████████████████████████████████▍ | 45362/58082 [00:17<00:09, 132Converting PyTorch Frontend ==> MIL Ops: 79%|█████████████████████████████████████████▋ | 45619/58082 [00:17<00:07, 157Converting PyTorch Frontend ==> MIL Ops: 79%|█████████████████████████████████████████▊ | 45803/58082 [00:17<00:08, 141Converting PyTorch Frontend ==> MIL Ops: 79%|█████████████████████████████████████████▉ | 45996/58082 [00:17<00:07, 152Converting PyTorch Frontend ==> MIL Ops: 79%|██████████████████████████████████████████▉ | 46167/58082 [00:18<00:15, 76Converting PyTorch Frontend ==> MIL Ops: 80%|██████████████████████████████████████████▍ | 46497/58082 [00:18<00:10, 112Converting PyTorch Frontend ==> MIL Ops: 80%|██████████████████████████████████████████▌ | 46686/58082 [00:18<00:10, 113Converting PyTorch Frontend ==> MIL Ops: 81%|██████████████████████████████████████████▊ | 46915/58082 [00:18<00:08, 133Converting PyTorch Frontend ==> MIL Ops: 81%|██████████████████████████████████████████▉ | 47100/58082 [00:18<00:10, 102Converting PyTorch Frontend ==> MIL Ops: 82%|███████████████████████████████████████████▏ | 47364/58082 [00:18<00:08, 129Converting PyTorch Frontend ==> MIL Ops: 82%|███████████████████████████████████████████▍ | 47545/58082 [00:19<00:09, 109Converting PyTorch Frontend ==> MIL Ops: 82%|███████████████████████████████████████████▌ | 47785/58082 [00:19<00:07, 132Converting PyTorch Frontend ==> MIL Ops: 83%|████████████████████████████████████████████▌ | 47958/58082 [00:19<00:10, 98Converting PyTorch Frontend ==> MIL Ops: 83%|████████████████████████████████████████████ | 48235/58082 [00:19<00:07, 128Converting PyTorch Frontend ==> MIL Ops: 83%|████████████████████████████████████████████▏ | 48415/58082 [00:19<00:08, 109Converting PyTorch Frontend ==> MIL Ops: 84%|████████████████████████████████████████████▍ | 48657/58082 [00:19<00:07, 132Converting PyTorch Frontend ==> MIL Ops: 84%|████████████████████████████████████████████▌ | 48832/58082 [00:20<00:09, 101Converting PyTorch Frontend ==> MIL Ops: 85%|████████████████████████████████████████████▊ | 49105/58082 [00:20<00:06, 130Converting PyTorch Frontend ==> MIL Ops: 85%|████████████████████████████████████████████▉ | 49283/58082 [00:20<00:07, 115Converting PyTorch Frontend ==> MIL Ops: 85%|█████████████████████████████████████████████▏ | 49527/58082 [00:20<00:06, 138Converting PyTorch Frontend ==> MIL Ops: 86%|█████████████████████████████████████████████▎ | 49704/58082 [00:20<00:07, 106Converting PyTorch Frontend ==> MIL Ops: 86%|█████████████████████████████████████████████▌ | 49975/58082 [00:20<00:05, 136Converting PyTorch Frontend ==> MIL Ops: 86%|█████████████████████████████████████████████▊ | 50156/58082 [00:21<00:06, 116Converting PyTorch Frontend ==> MIL Ops: 87%|█████████████████████████████████████████████▉ | 50396/58082 [00:21<00:05, 138Converting PyTorch Frontend ==> MIL Ops: 87%|██████████████████████████████████████████████▏ | 50571/58082 [00:21<00:07, 102Converting PyTorch Frontend ==> MIL Ops: 88%|██████████████████████████████████████████████▍ | 50845/58082 [00:21<00:05, 132Converting PyTorch Frontend ==> MIL Ops: 88%|██████████████████████████████████████████████▌ | 51023/58082 [00:21<00:05, 119Converting PyTorch Frontend ==> MIL Ops: 88%|██████████████████████████████████████████████▊ | 51265/58082 [00:22<00:04, 142Converting PyTorch Frontend ==> MIL Ops: 89%|██████████████████████████████████████████████▉ | 51443/58082 [00:22<00:06, 103Converting PyTorch Frontend ==> MIL Ops: 89%|███████████████████████████████████████████████▏ | 51713/58082 [00:22<00:04, 132Converting PyTorch Frontend ==> MIL Ops: 89%|███████████████████████████████████████████████▎ | 51893/58082 [00:22<00:05, 110Converting PyTorch Frontend ==> MIL Ops: 90%|███████████████████████████████████████████████▌ | 52134/58082 [00:22<00:04, 133Converting PyTorch Frontend ==> MIL Ops: 90%|████████████████████████████████████████████████▋ | 52309/58082 [00:23<00:05, 99Converting PyTorch Frontend ==> MIL Ops: 91%|███████████████████████████████████████████████▉ | 52583/58082 [00:23<00:04, 128Converting PyTorch Frontend ==> MIL Ops: 91%|████████████████████████████████████████████████▏ | 52761/58082 [00:23<00:04, 107Converting PyTorch Frontend ==> MIL Ops: 91%|████████████████████████████████████████████████▎ | 53004/58082 [00:23<00:03, 130Converting PyTorch Frontend ==> MIL Ops: 92%|█████████████████████████████████████████████████▍ | 53176/58082 [00:23<00:05, 96Converting PyTorch Frontend ==> MIL Ops: 92%|████████████████████████████████████████████████▊ | 53453/58082 [00:23<00:03, 124Converting PyTorch Frontend ==> MIL Ops: 92%|████████████████████████████████████████████████▉ | 53627/58082 [00:24<00:04, 103Converting PyTorch Frontend ==> MIL Ops: 93%|█████████████████████████████████████████████████▏ | 53874/58082 [00:24<00:03, 127Converting PyTorch Frontend ==> MIL Ops: 93%|██████████████████████████████████████████████████▏ | 54046/58082 [00:24<00:04, 93Converting PyTorch Frontend ==> MIL Ops: 94%|█████████████████████████████████████████████████▌ | 54322/58082 [00:24<00:03, 122Converting PyTorch Frontend ==> MIL Ops: 94%|█████████████████████████████████████████████████▋ | 54499/58082 [00:25<00:03, 101Converting PyTorch Frontend ==> MIL Ops: 94%|█████████████████████████████████████████████████▉ | 54743/58082 [00:25<00:02, 124Converting PyTorch Frontend ==> MIL Ops: 95%|███████████████████████████████████████████████████ | 54914/58082 [00:25<00:04, 69Converting PyTorch Frontend ==> MIL Ops: 95%|███████████████████████████████████████████████████▏ | 55047/58082 [00:25<00:03, 77Converting PyTorch Frontend ==> MIL Ops: 95%|███████████████████████████████████████████████████▎ | 55177/58082 [00:25<00:03, 77Converting PyTorch Frontend ==> MIL Ops: 95%|███████████████████████████████████████████████████▌ | 55394/58082 [00:26<00:02, 96Converting PyTorch Frontend ==> MIL Ops: 96%|███████████████████████████████████████████████████▌ | 55526/58082 [00:26<00:02, 96Converting PyTorch Frontend ==> MIL Ops: 96%|██████████████████████████████████████████████████▊ | 55654/58082 [00:26<00:02, 101Converting PyTorch Frontend ==> MIL Ops: 96%|██████████████████████████████████████████████████▉ | 55862/58082 [00:26<00:01, 117Converting PyTorch Frontend ==> MIL Ops: 96%|████████████████████████████████████████████████████ | 55996/58082 [00:26<00:03, 62Converting PyTorch Frontend ==> MIL Ops: 97%|████████████████████████████████████████████████████▏ | 56197/58082 [00:27<00:02, 80Converting PyTorch Frontend ==> MIL Ops: 97%|████████████████████████████████████████████████████▍ | 56405/58082 [00:27<00:01, 97Converting PyTorch Frontend ==> MIL Ops: 97%|████████████████████████████████████████████████████▌ | 56541/58082 [00:27<00:01, 86Converting PyTorch Frontend ==> MIL Ops: 98%|████████████████████████████████████████████████████▋ | 56687/58082 [00:27<00:01, 95Converting PyTorch Frontend ==> MIL Ops: 98%|███████████████████████████████████████████████████▊ | 56812/58082 [00:27<00:01, 101Converting PyTorch Frontend ==> MIL Ops: 98%|████████████████████████████████████████████████████▉ | 56934/58082 [00:27<00:01, 87Converting PyTorch Frontend ==> MIL Ops: 98%|█████████████████████████████████████████████████████ | 57038/58082 [00:28<00:01, 57Converting PyTorch Frontend ==> MIL Ops: 99%|█████████████████████████████████████████████████████▏| 57230/58082 [00:28<00:01, 77Converting PyTorch Frontend ==> MIL Ops: 99%|█████████████████████████████████████████████████████▍| 57438/58082 [00:28<00:00, 95Converting PyTorch Frontend ==> MIL Ops: 99%|█████████████████████████████████████████████████████▌| 57562/58082 [00:28<00:00, 83Converting PyTorch Frontend ==> MIL Ops: 99%|█████████████████████████████████████████████████████▋| 57720/58082 [00:28<00:00, 95Converting PyTorch Frontend ==> MIL Ops: 100%|████████████████████████████████████████████████████▊| 57928/58082 [00:28<00:00, 112Converting PyTorch Frontend ==> MIL Ops: 100%|█████████████████████████████████████████████████████▉| 58058/58082 [00:29<00:00, 40Converting PyTorch Frontend ==> MIL Ops: 100%|████████████████████████████████████████████████████▉| 58080/58082 [00:30<00:00, 1935.52 ops/s]
Running MIL frontend_pytorch pipeline: 100%|███████████████████████████████████████████████████| 5/5 [00:05<00:00, 1.13s/ passes]
Running MIL default pipeline: 82%|██████████████████████████████████████████████▌ | 58/71 [27:38<41:30, 191.59s/ passes]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment