Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into issues, takes me in a loop! #124

Open
Generalalen opened this issue Jan 14, 2025 · 2 comments
Open

Running into issues, takes me in a loop! #124

Generalalen opened this issue Jan 14, 2025 · 2 comments

Comments

@Generalalen
Copy link

(img2img-turbo) PS E:\projects\img2img-turbo-main> accelerate launch src/train_pix2pix_turbo.py `

--pretrained_model_name_or_path "stabilityai/sd-turbo" `
--output_dir "output/pix2pix_turbo/realestate" `
--dataset_folder "data/realestate" `
--resolution 512 `
--train_batch_size 2 `
--enable_xformers_memory_efficient_attention `
--viz_freq 25 `
--track_val_fid `
--report_to "wandb" `
--tracker_project_name "pix2pix_turbo_realestate"

C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\utils\generic.py:441: FutureWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
_torch_pytree._register_pytree_node(
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: 'Could not find module 'C:\Users\najaf\anaconda3\envs\img2img-turbo\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source?
warn(
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: 'Could not find module 'C:\Users\najaf\anaconda3\envs\img2img-turbo\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source?
warn(
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\utils\generic.py:441: FutureWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
_torch_pytree._register_pytree_node(
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\transformers\utils\generic.py:309: FutureWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
_torch_pytree._register_pytree_node(
WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.0.1+cu118 with CUDA 1108 (you have 2.5.1+cpu)
Python 3.10.11 (you have 3.10.16)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won't be available.
Set XFORMERS_MORE_DETAILS=1 for more details
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\xformers\ops\swiglu_op.py:107: FutureWarning: torch.cuda.amp.custom_fwd(args...) is deprecated. Please use torch.amp.custom_fwd(args..., device_type='cuda') instead.
def forward(cls, ctx, x, w1, b1, w2, b2, w3, b3):
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\xformers\ops\swiglu_op.py:128: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead.
def backward(cls, ctx, dx5):
Traceback (most recent call last):
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\import_utils.py", line 942, in get_module
return importlib.import_module("." + module_name, self.name)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\loaders\peft.py", line 38, in
from .lora_base import fetch_state_dict, func_optionally_disable_offloading
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\loaders\lora_base.py", line 56, in
from peft.tuners.tuners_utils import BaseTunerLayer
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\peft_init
.py", line 22, in
from .auto import (
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\peft\auto.py", line 32, in
from .mapping import MODEL_TYPE_TO_PEFT_MODEL_MAPPING
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\peft\mapping.py", line 25, in
from .mixed_model import PeftMixedModel
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\peft\mixed_model.py", line 29, in
from .peft_model import PeftModel
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\peft\peft_model.py", line 37, in
from transformers import Cache, DynamicCache, EncoderDecoderCache, PreTrainedModel
ImportError: cannot import name 'Cache' from 'transformers' (C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\transformers_init
.py)

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

Traceback (most recent call last):
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\import_utils.py", line 942, in get_module
return importlib.import_module("." + module_name, self.name)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 992, in _find_and_load_unlocked
File "", line 241, in _call_with_frames_removed
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in find_and_load_unlocked
File "", line 688, in load_unlocked
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\autoencoders_init
.py", line 1, in
from .autoencoder_asym_kl import AsymmetricAutoencoderKL
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\autoencoders\autoencoder_asym_kl.py", line 23, in
from .vae import DecoderOutput, DiagonalGaussianDistribution, Encoder, MaskConditionDecoder
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\autoencoders\vae.py", line 25, in
from ..unets.unet_2d_blocks import (
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\unets_init
.py", line 6, in
from .unet_2d import UNet2DModel
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\unets\unet_2d.py", line 24, in
from .unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\unets\unet_2d_blocks.py", line 36, in
from ..transformers.dual_transformer_2d import DualTransformer2DModel
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\transformers_init.py", line 6, in
from .cogvideox_transformer_3d import CogVideoXTransformer3DModel
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\models\transformers\cogvideox_transformer_3d.py", line 22, in
from ...loaders import PeftAdapterMixin
File "", line 1075, in _handle_fromlist
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\import_utils.py", line 932, in getattr
module = self._get_module(self._class_to_module[name])
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\import_utils.py", line 944, in get_module
raise RuntimeError(
RuntimeError: Failed to import diffusers.loaders.peft because of the following error (look up to see its traceback):
cannot import name 'Cache' from 'transformers' (C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\transformers_init
.py)

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

Traceback (most recent call last):
File "E:\projects\img2img-turbo-main\src\train_pix2pix_turbo.py", line 23, in
from pix2pix_turbo import Pix2Pix_Turbo
File "E:\projects\img2img-turbo-main\src\pix2pix_turbo.py", line 8, in
from diffusers import AutoencoderKL, UNet2DConditionModel
File "", line 1075, in _handle_fromlist
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\import_utils.py", line 933, in getattr
value = getattr(module, name)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\import_utils.py", line 932, in getattr
module = self._get_module(self._class_to_module[name])
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\import_utils.py", line 944, 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):
Failed to import diffusers.loaders.peft because of the following error (look up to see its traceback):
cannot import name 'Cache' from 'transformers' (C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\transformers_init
.py)
Traceback (most recent call last):
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\Scripts\accelerate.exe_main
.py", line 7, in
sys.exit(main())
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\accelerate\commands\accelerate_cli.py", line 48, in main
args.func(args)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\accelerate\commands\launch.py", line 1168, in launch_command
simple_launcher(args)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\accelerate\commands\launch.py", line 763, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['C:\Users\najaf\anaconda3\envs\img2img-turbo\python.exe', 'src/train_pix2pix_turbo.py', '--pretrained_model_name_or_path', 'stabilityai/sd-turbo', '--output_dir', 'output/pix2pix_turbo/realestate', '--dataset_folder', 'data/realestate', '--resolution', '512', '--train_batch_size', '2', '--enable_xformers_memory_efficient_attention', '--viz_freq', '25', '--track_val_fid', '--report_to', 'wandb', '--tracker_project_name', 'pix2pix_turbo_realestate']' returned non-zero exit status 1.
Now, the issue is, I have PyTorch 2.0.1+cu118 with CUDA 1108, even tho it states I dont. I dont know what to do!

@Generalalen
Copy link
Author

(img2img-turbo) PS E:\projects\img2img-turbo-main> accelerate launch src/train_pix2pix_turbo.py
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: 'Could not find module 'C:\Users\najaf\anaconda3\envs\img2img-turbo\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source?
warn(
C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: 'Could not find module 'C:\Users\najaf\anaconda3\envs\img2img-turbo\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source?
warn(
Traceback (most recent call last):
File "E:\projects\img2img-turbo-main\src\train_pix2pix_turbo.py", line 16, in
import diffusers
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers_init_.py", line 5, in
from .utils import (
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils_init_.py", line 37, in
from .dynamic_modules_utils import get_class_from_dynamic_module
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\dynamic_modules_utils.py", line 28, in
from huggingface_hub import cached_download, hf_hub_download, model_info
ImportError: cannot import name 'cached_download' from 'huggingface_hub' (C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\huggingface_hub_init_.py)
Traceback (most recent call last):
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\najaf\Anaconda3\envs\img2img-turbo\Scripts\accelerate.exe_main
.py", line 7, in
sys.exit(main())
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\accelerate\commands\accelerate_cli.py", line 48, in main
args.func(args)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\accelerate\commands\launch.py", line 1168, in launch_command
simple_launcher(args)
File "C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\accelerate\commands\launch.py", line 763, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['C:\Users\najaf\anaconda3\envs\img2img-turbo\python.exe', 'src/train_pix2pix_turbo.py', '\']' returned non-zero exit status 1.

@andjoer
Copy link

andjoer commented Jan 16, 2025

I think you have two issues: 1) your xformers package was installed for a different version of torch 2) a diffusers package was install that contained a bug (the cached download failing to load). The first issue could maybe be solved by setting up a new environment and installing the requirements again. The second one by removing the import of cached download in C:\Users\najaf\anaconda3\envs\img2img-turbo\lib\site-packages\diffusers\utils\dynamic_modules_utils.py. Solution two for all would be to upgrade some packages to the latest version after you installed the requirements.txt:

git install git+https://github.com/huggingface/diffusers --upgrade
pip install torch torchvision torchaudio --upgrade
pip install xformers --upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants