bmaltais/kohya_ss

AttributeError: module 'torch' has no attribute 'compiler'

Open

#2,071 建立於 2024年3月12日

在 GitHub 查看
 (10 留言) (5 反應) (0 負責人)Python (970 fork)batch import
help wanted

倉庫指標

Star
 (7,258 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述


Title

AttributeError: module 'torch' has no attribute 'compiler'

Body

Environment Information

  • Python version: (Python 3.10.9)
  • Device Information: (macOS Sonoma 14.3.1 Apple M3 Pro)
  • Other possibly relevant environment informatio(torch 2.2.1 torchvision. 0.17.1)

Description

When attempting to use Kohyas for Lora model training, I encountered the following error message:

Traceback (most recent call last):
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 710, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/models/autoencoders/__init__.py", line 1, in <module>
    from .autoencoder_asym_kl import AsymmetricAutoencoderKL
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/models/autoencoders/autoencoder_asym_kl.py", line 23, in <module>
    from .vae import DecoderOutput, DiagonalGaussianDistribution, Encoder, MaskConditionDecoder
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/models/autoencoders/vae.py", line 24, in <module>
    from ..attention_processor import SpatialNorm
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/models/attention_processor.py", line 31, in <module>
    import xformers
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/xformers/__init__.py", line 12, in <module>
    from .checkpoint import (  # noqa: E402, F401
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/xformers/checkpoint.py", line 437, in <module>
    class SelectiveCheckpointWrapper(ActivationWrapper):
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/xformers/checkpoint.py", line 449, in SelectiveCheckpointWrapper
    @torch.compiler.disable
AttributeError: module 'torch' has no attribute 'compiler'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/a123/kohya_ss/sd-scripts/train_network.py", line 22, in <module>
    from library import model_util
  File "/Users/a123/kohya_ss/sd-scripts/library/model_util.py", line 13, in <module>
    from diffusers import AutoencoderKL, DDIMScheduler, StableDiffusionPipeline  # , UNet2DConditionModel
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 701, in __getattr__
    value = getattr(module, name)
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 700, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 712, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
module 'torch' has no attribute 'compiler'
Traceback (most recent call last):
  File "/Users/a123/kohya_ss/venv/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 47, in main
    args.func(args)
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1017, in launch_command
    simple_launcher(args)
  File "/Users/a123/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 637, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/Users/a123/kohya_ss/venv/bin/python', '/Users/a123/kohya_ss/sd-scripts/train_network.py', '--bucket_no_upscale', '--bucket_reso_steps=64', '--cache_latents', '--caption_dropout_rate=0.5', '--enable_bucket', '--min_bucket_reso=256', '--max_bucket_reso=2048', '--gradient_checkpointing', '--keep_tokens=1', '--learning_rate=1.0', '--logging_dir=/Users/a123/my/AI workShop/training/lora/ZhongLi /log', '--lr_scheduler=constant', '--lr_scheduler_num_cycles=300', '--max_data_loader_n_workers=0', '--max_grad_norm=1', '--resolution=512,512', '--max_train_steps=1000', '--min_snr_gamma=5', '--mixed_precision=fp16', '--network_alpha=1024', '--network_args', 'preset=full', 'conv_dim=1', 'conv_alpha=1', 'train_on_input=True', 'algo=ia3', '--network_dim=1024', '--network_dropout=0.3', '--network_module=lycoris.kohya', '--noise_offset=0.05', '--adaptive_noise_scale=0.005', '--optimizer_args', 'd_coef=1.0', 'weight_decay=0.01', 'safeguard_warmup=False', 'use_bias_correction=False', '--optimizer_type=Prodigy', '--output_dir=/Users/a123/my/AI workShop/training/lora/ZhongLi /models', '--output_name=test_ZhongLi', '--pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5', '--save_every_n_epochs=10', '--save_model_as=safetensors', '--save_precision=fp16', '--scale_weight_norms=1', '--seed=31337', '--shuffle_caption', '--text_encoder_lr=1.0', '--train_batch_size=1', '--training_comment=rentry.co/ProdiAgy', '--train_data_dir=/Users/a123/my/AI workShop/training/lora/ZhongLi /image', '--unet_lr=1.0', '--xformers']' returned non-zero exit status 1.

Additionally, upon launching Kohya, the INFO is as follows:

15:34:08-815508 INFO     Kohya_ss GUI version: v23.0.5                                                                                                            
15:34:08-894788 INFO     Submodule initialized and updated.                                                                                                       
15:34:08-896363 INFO     Using CPU-only Torch                                                                                                                     
15:34:09-487788 INFO     Torch 2.0.0                                                                                                                              
15:34:09-488351 WARNING  Torch reports CUDA not available                                                                                                         
15:34:09-488702 INFO     Python version is 3.10.9 (v3.10.9:1dd9be6584, Dec  6 2022, 14:37:36) [Clang 13.0.0 (clang-1300.0.29.30)]                                 
15:34:09-489184 INFO     Verifying modules installation status from /Users/a123/kohya_ss/requirements_macos_arm64.txt...                                          
15:34:09-489959 INFO     Installing package: torch==2.0.0 torchvision==0.15.1 -f https://download.pytorch.org/whl/cpu/torch_stable.html                           
15:34:13-781302 INFO     Verifying modules installation status from requirements.txt...                                                                           
15:34:13-784176 INFO     Installing package: onnxruntime-gpu==1.16.0                                                                                              
15:34:14-387953 ERROR    Error running pip: install --upgrade onnxruntime-gpu==1.16.0                                                                             
15:34:15-641249 INFO     headless: False                                                                                                                          
15:34:15-643887 INFO     Load CSS...  

貢獻者指南