Add Support for Python 3.11 and PyTorch 2.0#295
Add Support for Python 3.11 and PyTorch 2.0#295inarikami wants to merge 4 commits intolllyasviel:mainfrom
Conversation
|
Did you notice any speedup when using pt 2.0 and compiling the models? |
|
Most of the speedup during training and inference will be by manually adding the new optimization techniques. See: https://huggingface.co/docs/diffusers/optimization/torch2.0 |
|
@tensorneko Hi, I am using version 1.5, and I followed your modifications. It worked fine. |
Raising some issues I found when running ControlNet with Python 3.11 and PyTorch 2.0. The changes required to run with these versions this are outlined below:
Fix 1:
Encountered a ValueError when running python tool_add_control_sd21.py ./models/v2-1_768-ema-pruned.ckpt ./models/control_sd21_ini.ckpt.
Error message:
Solution:
Implemented the fix from the following commit in HuggingFace's PyTorch Image Models repository:
huggingface/pytorch-image-models@a482365
Alternatively, you can use the pre-release version of timm by running pip install --pre timm.
Fix 2:
Encountered an ImportError for rank_zero_only from pytorch_lightning.utilities.distributed.
Replace:
With:
Fix 3:
remove dataloader_idx param in 'ImageLogger' and 'def on_train_batch_start(self, batch, batch_idx):'
Then you can train successfully with Python 3.11 and PyTorch 2.0, also added cpu core variable for more efficient data loading.