DSaurus / threestudio-dreamcraft3D

57 stars 1 forks source link

error at Stage 3 - TypeError: AttnProcessor2_0.__call__() got an unexpected keyword argument 'scale' #4

Open altava-sgp opened 9 months ago

altava-sgp commented 9 months ago

This is log.

$ python launch.py --config custom/threestudio-dreamcraft3D/configs/dreamcraft3d-texture.yaml --train system.prompt_processor.prompt="a denim jacket with buttons and a brown and blue color scheme" data.image_path="load/images/denim-jacket_rgba.png" system.geometry_convert_from="outputs/dreamcraft3d-coarse-nerf/a_denim_jacket_with_buttons_and_a_brown_and_blue_color_scheme@20231220-025154/ckpts/last.ckpt"

Import times for custom modules:
   0.1 seconds: custom/threestudio-mvdream
   0.2 seconds: custom/threestudio-dreamcraft3D

Global seed set to 0
[INFO] Initializing geometry from a given checkpoint ...
[INFO] Loading Stable Diffusion ...
Downloading (…)ch_model.safetensors: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.46G/3.46G [05:03<00:00, 11.4MB/s]
Fetching 8 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [05:04<00:00, 38.01s/it]
Loading pipeline components...: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:01<00:00,  3.03it/s]
Loading pipeline components...: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00,  4.49it/s]
[INFO] Loaded Stable Diffusion!
[INFO] Using prompt [a denim jacket with buttons and a brown and blue color scheme] and negative prompt []
[INFO] Using view-dependent prompts [side]:[a denim jacket with buttons and a brown and blue color scheme, side view] [front]:[a denim jacket with buttons and a brown and blue color scheme, front view] [back]:[a denim jacket with buttons and a brown and blue color scheme, back view] [overhead]:[a denim jacket with buttons and a brown and blue color scheme, overhead view]
/home/dreamer/.local/lib/python3.10/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
  warnings.warn(
/home/dreamer/.local/lib/python3.10/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=VGG16_Weights.IMAGENET1K_V1`. You can also use `weights=VGG16_Weights.DEFAULT` to get the most up-to-date weights.
  warnings.warn(msg)
loaded pretrained LPIPS loss from threestudio/utils/lpips/vgg.pth
[INFO] ModelCheckpoint(save_last=True, save_top_k=-1, monitor=None) will duplicate the last checkpoint saved.
[INFO] GPU available: True (cuda), used: True
[INFO] TPU available: False, using: 0 TPU cores
[INFO] IPU available: False, using: 0 IPUs
[INFO] HPU available: False, using: 0 HPUs
[rank: 0] Global seed set to 0
Initializing distributed: GLOBAL_RANK: 0, MEMBER: 1/1
[INFO] ----------------------------------------------------------------------------------------------------
distributed_backend=nccl
All distributed processes registered. Starting with 1 processes
----------------------------------------------------------------------------------------------------

[INFO] You are using a CUDA device ('NVIDIA GeForce RTX 4090') that has Tensor Cores. To properly utilize them, you should set `torch.set_float32_matmul_precision('medium' | 'high')` which will trade-off precision for performance. For more details, read https://pytorch.org/docs/stable/generated/torch.set_float32_matmul_precision.html#torch.set_float32_matmul_precision
[INFO] single image dataset: load image load/images/denim-jacket_rgba.png torch.Size([1, 1024, 1024, 3])
[INFO] single image dataset: load image load/images/denim-jacket_rgba.png torch.Size([1, 1024, 1024, 3])
[INFO] LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]
[INFO] 
  | Name       | Type                       | Params
----------------------------------------------------------
0 | geometry   | TetrahedraSDFGrid          | 12.6 M
1 | material   | NoMaterial                 | 0     
2 | background | SolidColorBackground       | 0     
3 | renderer   | NVDiffRasterizer           | 0     
4 | guidance   | StableDiffusionBSDGuidance | 1.7 B 
----------------------------------------------------------
1.7 B     Trainable params
0         Non-trainable params
1.7 B     Total params
6,990.986 Total estimated model params size (MB)
[INFO] Validation results will be saved to outputs/dreamcraft3d-texture/a_denim_jacket_with_buttons_and_a_brown_and_blue_color_scheme@20231220-055856/save
/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/connectors/data_connector.py:442: PossibleUserWarning: The dataloader, train_dataloader, does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` (try 20 which is the number of cpus on this machine) in the `DataLoader` init to improve performance.
  rank_zero_warn(
/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/connectors/data_connector.py:442: PossibleUserWarning: The dataloader, val_dataloader, does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` (try 20 which is the number of cpus on this machine) in the `DataLoader` init to improve performance.
  rank_zero_warn(
Epoch 0: : 0it [00:00, ?it/s]Traceback (most recent call last):
  File "/home/dreamer/threestudio/launch.py", line 301, in <module>
    main(args, extras)
  File "/home/dreamer/threestudio/launch.py", line 244, in main
    trainer.fit(system, datamodule=dm, ckpt_path=cfg.resume)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 532, in fit
    call._call_and_handle_interrupt(
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py", line 42, in _call_and_handle_interrupt
    return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 93, in launch
    return function(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 571, in _fit_impl
    self._run(model, ckpt_path=ckpt_path)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 980, in _run
    results = self._run_stage()
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 1023, in _run_stage
    self.fit_loop.run()
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/fit_loop.py", line 202, in run
    self.advance()
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/fit_loop.py", line 355, in advance
    self.epoch_loop.run(self._data_fetcher)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/training_epoch_loop.py", line 133, in run
    self.advance(data_fetcher)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/training_epoch_loop.py", line 219, in advance
    batch_output = self.automatic_optimization.run(trainer.optimizers[0], kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 188, in run
    self._optimizer_step(kwargs.get("batch_idx", 0), closure)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 266, in _optimizer_step
    call._call_lightning_module_hook(
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py", line 146, in _call_lightning_module_hook
    output = fn(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/core/module.py", line 1270, in optimizer_step
    optimizer.step(closure=optimizer_closure)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/core/optimizer.py", line 161, in step
    step_output = self._strategy.optimizer_step(self._optimizer, closure, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/strategies/ddp.py", line 257, in optimizer_step
    optimizer_output = super().optimizer_step(optimizer, closure, model, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/strategies/strategy.py", line 231, in optimizer_step
    return self.precision_plugin.optimizer_step(optimizer, model=model, closure=closure, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/plugins/precision/precision_plugin.py", line 116, in optimizer_step
    return optimizer.step(closure=closure, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/optim/optimizer.py", line 280, in wrapper
    out = func(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/optim/optimizer.py", line 33, in _use_grad
    ret = func(self, *args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/optim/adamw.py", line 148, in step
    loss = closure()
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/plugins/precision/precision_plugin.py", line 103, in _wrap_closure
    closure_result = closure()
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 142, in __call__
    self._result = self.closure(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 128, in closure
    step_output = self._step_fn()
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 315, in _training_step
    training_step_output = call._call_strategy_hook(trainer, "training_step", *kwargs.values())
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py", line 294, in _call_strategy_hook
    output = fn(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/strategies/ddp.py", line 330, in training_step
    return self.model(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 1156, in forward
    output = self._run_ddp_forward(*inputs, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 1110, in _run_ddp_forward
    return module_to_run(*inputs[0], **kwargs[0])  # type: ignore[index]
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/pytorch_lightning/overrides/base.py", line 90, in forward
    output = self._forward_module.training_step(*inputs, **kwargs)
  File "/home/dreamer/threestudio/custom/threestudio-dreamcraft3D/system/dreamcraft3d.py", line 420, in training_step
    out = self.training_substep(
  File "/home/dreamer/threestudio/custom/threestudio-dreamcraft3D/system/dreamcraft3d.py", line 222, in training_substep
    guidance_out = self.guidance(
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/threestudio/custom/threestudio-dreamcraft3D/guidance/stable_diffusion_bsd_guidance.py", line 1159, in forward
    loss_pretrain = self.train_pretrain(
  File "/home/dreamer/threestudio/custom/threestudio-dreamcraft3D/guidance/stable_diffusion_bsd_guidance.py", line 1015, in train_pretrain
    images_sample = self._sample(
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/amp/autocast_mode.py", line 14, in decorate_autocast
    return func(*args, **kwargs)
  File "/home/dreamer/threestudio/custom/threestudio-dreamcraft3D/guidance/stable_diffusion_bsd_guidance.py", line 402, in _sample
    noise_pred = unet(
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/diffusers/models/unet_2d_condition.py", line 930, in forward
    sample, res_samples = downsample_block(
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/diffusers/models/unet_2d_blocks.py", line 1053, in forward
    hidden_states = attn(
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/diffusers/models/transformer_2d.py", line 309, in forward
    hidden_states = block(
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/diffusers/models/attention.py", line 194, in forward
    attn_output = self.attn1(
  File "/home/dreamer/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/dreamer/.local/lib/python3.10/site-packages/diffusers/models/attention_processor.py", line 322, in forward
    return self.processor(
TypeError: AttnProcessor2_0.__call__() got an unexpected keyword argument 'scale'
altava-sgp commented 9 months ago

I updated diffusers.

$ pip install -U diffusers
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: diffusers in /home/dreamer/.local/lib/python3.10/site-packages (0.20.2)
Collecting diffusers
  Downloading diffusers-0.24.0-py3-none-any.whl.metadata (18 kB)
Requirement already satisfied: Pillow in /home/dreamer/.local/lib/python3.10/site-packages (from diffusers) (9.3.0)
Requirement already satisfied: filelock in /home/dreamer/.local/lib/python3.10/site-packages (from diffusers) (3.9.0)
Collecting huggingface-hub>=0.19.4 (from diffusers)
  Downloading huggingface_hub-0.19.4-py3-none-any.whl.metadata (14 kB)
Requirement already satisfied: importlib-metadata in /home/dreamer/.local/lib/python3.10/site-packages (from diffusers) (6.8.0)
Requirement already satisfied: numpy in /home/dreamer/.local/lib/python3.10/site-packages (from diffusers) (1.24.1)
Requirement already satisfied: regex!=2019.12.17 in /home/dreamer/.local/lib/python3.10/site-packages (from diffusers) (2023.8.8)
Requirement already satisfied: requests in /home/dreamer/.local/lib/python3.10/site-packages (from diffusers) (2.28.1)
Requirement already satisfied: safetensors>=0.3.1 in /home/dreamer/.local/lib/python3.10/site-packages (from diffusers) (0.3.3)
Requirement already satisfied: fsspec>=2023.5.0 in /home/dreamer/.local/lib/python3.10/site-packages (from huggingface-hub>=0.19.4->diffusers) (2023.9.0)
Requirement already satisfied: tqdm>=4.42.1 in /home/dreamer/.local/lib/python3.10/site-packages (from huggingface-hub>=0.19.4->diffusers) (4.66.1)
Requirement already satisfied: pyyaml>=5.1 in /home/dreamer/.local/lib/python3.10/site-packages (from huggingface-hub>=0.19.4->diffusers) (6.0.1)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/dreamer/.local/lib/python3.10/site-packages (from huggingface-hub>=0.19.4->diffusers) (4.7.1)
Requirement already satisfied: packaging>=20.9 in /home/dreamer/.local/lib/python3.10/site-packages (from huggingface-hub>=0.19.4->diffusers) (23.1)
Requirement already satisfied: zipp>=0.5 in /home/dreamer/.local/lib/python3.10/site-packages (from importlib-metadata->diffusers) (3.16.2)
Requirement already satisfied: charset-normalizer<3,>=2 in /home/dreamer/.local/lib/python3.10/site-packages (from requests->diffusers) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in /home/dreamer/.local/lib/python3.10/site-packages (from requests->diffusers) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/dreamer/.local/lib/python3.10/site-packages (from requests->diffusers) (1.26.13)
Requirement already satisfied: certifi>=2017.4.17 in /home/dreamer/.local/lib/python3.10/site-packages (from requests->diffusers) (2022.12.7)
Downloading diffusers-0.24.0-py3-none-any.whl (1.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 40.1 MB/s eta 0:00:00
Downloading huggingface_hub-0.19.4-py3-none-any.whl (311 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 311.7/311.7 kB 25.4 MB/s eta 0:00:00
Installing collected packages: huggingface-hub, diffusers
  Attempting uninstall: huggingface-hub
    Found existing installation: huggingface-hub 0.16.4
    Uninstalling huggingface-hub-0.16.4:
      Successfully uninstalled huggingface-hub-0.16.4
  Attempting uninstall: diffusers
    Found existing installation: diffusers 0.20.2
    Uninstalling diffusers-0.20.2:
      Successfully uninstalled diffusers-0.20.2
Successfully installed diffusers-0.24.0 huggingface-hub-0.19.4
knicholes commented 7 months ago

Don't update diffusers to version 26 or above (24 works).

altava-sgp commented 6 months ago
pip install -U diffusers==0.24