Giter Site home page Giter Site logo

Comments (13)

MrKuenning avatar MrKuenning commented on June 27, 2024

I also got this error

Doing standard LoRA training, both with 1.5 and 2.1 models.

ImportError: cannot import name 'CompVisVDenoiser' from 'k_diffusion.external'
(C:\Users\Brady\AppData\Local\Programs\Python\Python310\lib\site-packages\k_diffusion\external.py)

[Errno 2] No such file or directory:
'E:\AI\kohya_ss\venv\Scripts\accelerate.exe\main.py'

Console Output


│ E:\AI\kohya_ss\venv\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffu │
│ sion_k_diffusion.py:20 in <module>                                                               │
│                                                                                                  │
│    17                                                                                            │
│    18 import torch                                                                               │
│    19                                                                                            │
│ ❱  20 from k_diffusion.external import CompVisDenoiser, CompVisVDenoiser                         │
│    21                                                                                            │
│    22 from ... import DiffusionPipeline                                                          │
│    23 from ...schedulers import LMSDiscreteScheduler                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'CompVisVDenoiser' from 'k_diffusion.external'
(C:\Users\Brady\AppData\Local\Programs\Python\Python310\lib\site-packages\k_diffusion\external.py)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\Brady\AppData\Local\Programs\Python\Python310\lib\runpy.py:196 in _run_module_as_main   │
│                                                                                                  │
│   193 │   main_globals = sys.modules["__main__"].__dict__                                        │
│   194 │   if alter_argv:                                                                         │
│   195 │   │   sys.argv[0] = mod_spec.origin                                                      │
│ ❱ 196 │   return _run_code(code, main_globals, None,                                             │
│   197 │   │   │   │   │    "__main__", mod_spec)                                                 │
│   198                                                                                            │
│   199 def run_module(mod_name, init_globals=None,                                                │
│                                                                                                  │
│ C:\Users\Brady\AppData\Local\Programs\Python\Python310\lib\runpy.py:86 in _run_code              │
│                                                                                                  │
│    83 │   │   │   │   │      __loader__ = loader,                                                │
│    84 │   │   │   │   │      __package__ = pkg_name,                                             │
│    85 │   │   │   │   │      __spec__ = mod_spec)                                                │
│ ❱  86 │   exec(code, run_globals)                                                                │
│    87 │   return run_globals                                                                     │
│    88                                                                                            │
│    89 def _run_module_code(code, init_globals=None,                                              │
│                                                                                                  │
│ E:\AI\kohya_ss\venv\Scripts\accelerate.exe\__main__.py:7 in <module>                             │
│                                                                                                  │
│ [Errno 2] No such file or directory:                                                             │
│ 'E:\\AI\\kohya_ss\\venv\\Scripts\\accelerate.exe\\__main__.py'                                │
│                                                                                                  │
│ E:\AI\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py:45 in main           │
│                                                                                                  │
│   42 │   │   exit(1)                                                                             │
│   43 │                                                                                           │
│   44 │   # Run                                                                                   │
│ ❱ 45 │   args.func(args)                                                                         │
│   46                                                                                             │
│   47                                                                                             │
│   48 if __name__ == "__main__":                                                                  │
│                                                                                                  │

from kohya_ss.

bmaltais avatar bmaltais commented on June 27, 2024

This typically happen if you are installing modules outside the venv... or if you already have installed similar modules outside the venv.

This can be cause if you did not give unrestricted script access to powershell so venv can work:

  • Open an administrator powershell window
  • Type Set-ExecutionPolicy Unrestricted and answer A
  • Close admin powershell window

One quick fix is to uninstall everything from the local env and re-install everything in the venv:

Open a new powershell window and run:

pip freeze > uninstall.txt
pip uninstall -r uninstall.txt

Then redo the kohya_ss installation.

from kohya_ss.

MrKuenning avatar MrKuenning commented on June 27, 2024

That got me farther than before, but I still got an error...

Folder 100_charleshardman person: 1200 steps

Use DreamBooth method.
prepare train images.
found directory contains 12 image files
1200 train images with repeating.
loading image sizes.
100%|█████████████████████████████████| 12/12 [00:00<00:00, 1401.02it/s]
make buckets
number of images (including repeats)
bucket 8: resolution (512, 512), count: 1200
mean ar error (without repeats): 0.0
prepare accelerator
Using accelerator 0.15.0 or above.
load StableDiffusion checkpoint
loading u-net: <All keys matched successfully>
loading vae: <All keys matched successfully>
  File "E:\AI\kohya_ss\library\train_util.py", line 969, in replace_unet_cross_attn_to_xformers
    import xformers.ops

ModuleNotFoundError: No module named 'xformers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\AI\kohya_ss\train_network.py", line 424, in <module>
    train(args)
  File "E:\AI\kohya_ss\train_network.py", line 67, in train
    train_util.replace_unet_modules(unet, args.mem_eff_attn, args.xformers)
  File "E:\AI\kohya_ss\library\train_util.py", line 923, in replace_unet_modules
    replace_unet_cross_attn_to_xformers()
  File "E:\AI\kohya_ss\library\train_util.py", line 971, in replace_unet_cross_attn_to_xformers
    raise ImportError("No xformers / xformersがインストールされていないようです")
ImportError: No xformers / xformersがインストールされていないようです
Traceback (most recent call last):
  File "C:\Users\Brady\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Brady\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "E:\AI\kohya_ss\venv\Scripts\accelerate.exe\__main__.py", line 7, in <module>
  File "E:\AI\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py", line 45, in main
    args.func(args)
  File "E:\AI\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 1104, in launch_command
    simple_launcher(args)
  File "E:\AI\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 567, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['E:\\AI\\kohya_ss\\venv\\Scripts\\python.exe', 'train_network.py', '--enable_bucket', '--pretrained_model_name_or_path=E:/AI/Training/v1.5.ckpt', '--train_data_dir=E:\\AI\\Training\\aspen-4rd-512-Lora-Final\\img', '--resolution=512,512', '--output_dir=E:\\AI\\Training\\aspen-4rd-512-Lora-Final\\model', '--use_8bit_adam', '--xformers', '--logging_dir=E:\\AI\\Training\\aspen-4rd-512-Lora-Final\\log', '--network_module=networks.lora', '--text_encoder_lr=5e-5', '--unet_lr=1e-3', '--network_dim=8', '--output_name=last', '--learning_rate=1e-5', '--lr_scheduler=cosine', '--lr_warmup_steps=120', '--train_batch_size=1', '--max_train_steps=1200', '--save_every_n_epochs=1', '--mixed_precision=fp16', '--save_precision=fp16', '--seed=1234', '--cache_latents', '--xformers', '--use_8bit_adam']' returned non-zero exit status 1.

from kohya_ss.

MrKuenning avatar MrKuenning commented on June 27, 2024

I resolved the above error by copying the xformers and xformers-0.0.14.dev0.dist-info folders from the venv folder in my Automatic1111 folder.

from kohya_ss.

SatyamSSJ10 avatar SatyamSSJ10 commented on June 27, 2024

This typically happen if you are installing modules outside the venv... or if you already have installed similar modules outside the venv.

This can be cause if you did not give unrestricted script access to powershell so venv can work:

* Open an administrator powershell window

* Type `Set-ExecutionPolicy Unrestricted` and answer A

* Close admin powershell window

One quick fix is to uninstall everything from the local env and re-install everything in the venv:

Open a new powershell window and run:

pip freeze > uninstall.txt
pip uninstall -r uninstall.txt

Then redo the kohya_ss installation.

is it really necessary to uninstall from the PC's environment? I honestly don't want to uninstall commonly used modules like torch

from kohya_ss.

SatyamSSJ10 avatar SatyamSSJ10 commented on June 27, 2024

I resolved the above error by copying the xformers and xformers-0.0.14.dev0.dist-info folders from the venv folder in my Automatic1111 folder.

did you uninstall from your local environment?

from kohya_ss.

SatyamSSJ10 avatar SatyamSSJ10 commented on June 27, 2024

This typically happen if you are installing modules outside the venv... or if you already have installed similar modules outside the venv.

This can be cause if you did not give unrestricted script access to powershell so venv can work:

* Open an administrator powershell window

* Type `Set-ExecutionPolicy Unrestricted` and answer A

* Close admin powershell window

One quick fix is to uninstall everything from the local env and re-install everything in the venv:

Open a new powershell window and run:

pip freeze > uninstall.txt
pip uninstall -r uninstall.txt

Then redo the kohya_ss installation.

Still facing the same.
I uninstalled using
pip uninstall -r requirements.txt

and then redid the setup

from kohya_ss.

MrKuenning avatar MrKuenning commented on June 27, 2024

Yes, I ran both uninstalls, the second one removed almost all of my AppData python files. It also took a while to say yes to almost 300 items.

I had tried many StableDiffusion reops in the past but almost exclusively use A1111 now, which also uses a VENV folder and not the AppData python folder. So it was kinda nice to remove all of that stuff anyway.

After I removed all of that I deleted the Kohya folder and reinstalled it. Re-running it threw a new error saying xformers was missing so I had to copy that from my a1111 install.

After that, it ran fine and made a decent first LoRA in about 15 minutes.

from kohya_ss.

bmaltais avatar bmaltais commented on June 27, 2024

The error about xformer is puzzling... I will need to try a full re-install... perhaps the source URL for it has been removed... Let me test on my system

from kohya_ss.

bmaltais avatar bmaltais commented on June 27, 2024

All went fine on my end. xformers installed fine also

from kohya_ss.

Odawgthat avatar Odawgthat commented on June 27, 2024

This typically happen if you are installing modules outside the venv... or if you already have installed similar modules outside the venv.

This can be cause if you did not give unrestricted script access to powershell so venv can work:

  • Open an administrator powershell window
  • Type Set-ExecutionPolicy Unrestricted and answer A
  • Close admin powershell window

One quick fix is to uninstall everything from the local env and re-install everything in the venv:

Open a new powershell window and run:

pip freeze > uninstall.txt
pip uninstall -r uninstall.txt

Then redo the kohya_ss installation.

DIDNT WORK! It still says that the folder venv/Scripts/accelerate doesn't exist?

from kohya_ss.

SatyamSSJ10 avatar SatyamSSJ10 commented on June 27, 2024

All went fine on my end. xformers installed fine also

I'm using Kohya's original sd scripts, and they did show these errors sometimes too, It was when RAM wasn't enough to load the stuff, and similar scenarios.

from kohya_ss.

Ho-gyo avatar Ho-gyo commented on June 27, 2024

Hi, please, could you provide an installer that work! I tried your suggestions but none worked for me.

from kohya_ss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.