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

AttributeError: NEAREST_EXACT` #9

Open
Cubey42 opened this issue Feb 4, 2024 · 2 comments
Open

AttributeError: NEAREST_EXACT` #9

Cubey42 opened this issue Feb 4, 2024 · 2 comments

Comments

@Cubey42
Copy link

Cubey42 commented Feb 4, 2024

│ I:\AnimateDiff-MotionDirector\train.py:1038 in <module>                                          │
│                                                                                                  │
│   1035 │   if getattr(config, "simple_mode", False):                                             │
│   1036 │   │   config = get_simple_config(config)                                                │
│   1037 │                                                                                         │
│ ❱ 1038 │   main(name=name, use_wandb=args.wandb, **config)                                       │
│   1039                                                                                           │
│                                                                                                  │
│ I:\AnimateDiff-MotionDirector\train.py:589 in main                                               │
│                                                                                                  │
│    586 │                                                                                         │
│    587 │   if cache_latents:                                                                     │
│    588 │   │   torch.multiprocessing.set_start_method('spawn')                                   │
│ ❱  589 │   │   train_dataloader = handle_cache_latents(                                          │
│    590 │   │   │   cache_latents,                                                                │
│    591 │   │   │   output_dir,                                                                   │
│    592 │   │   │   train_dataloader,                                                             │
│                                                                                                  │
│ I:\AnimateDiff-MotionDirector\train.py:168 in handle_cache_latents                               │
│                                                                                                  │
│    165 │   │   cache_save_dir = f"{output_dir}/cached_latents"                                   │
│    166 │   │   os.makedirs(cache_save_dir, exist_ok=True)                                        │
│    167 │   │                                                                                     │
│ ❱  168 │   │   for i, batch in enumerate(tqdm(train_dataloader, desc="Caching Latents.")):       │
│    169 │   │   │                                                                                 │
│    170 │   │   │   frames = batch['pixel_values'].shape[1]                                       │
│    171                                                                                           │
│                                                                                                  │
│ C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\tqdm\std.py:1182 in __iter__         │
│                                                                                                  │
│   1179 │   │   time = self._time                                                                 │
│   1180 │   │                                                                                     │
│   1181 │   │   try:                                                                              │
│ ❱ 1182 │   │   │   for obj in iterable:                                                          │
│   1183 │   │   │   │   yield obj                                                                 │
│   1184 │   │   │   │   # Update and possibly print the progressbar.                              │
│   1185 │   │   │   │   # Note: does not call self.update(1) for speed optimisation.              │
│                                                                                                  │
│ C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\utils\data\dataloader.py:628   │
│ in __next__                                                                                      │
│                                                                                                  │
│    625 │   │   │   if self._sampler_iter is None:                                                │
│    626 │   │   │   │   # TODO(https://github.com/pytorch/pytorch/issues/76750)                   │
│    627 │   │   │   │   self._reset()  # type: ignore[call-arg]                                   │
│ ❱  628 │   │   │   data = self._next_data()                                                      │
│    629 │   │   │   self._num_yielded += 1                                                        │
│    630 │   │   │   if self._dataset_kind == _DatasetKind.Iterable and \                          │
│    631 │   │   │   │   │   self._IterableDataset_len_called is not None and \                    │
│                                                                                                  │
│ C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\utils\data\dataloader.py:1333  │
│ in _next_data                                                                                    │
│                                                                                                  │
│   1330 │   │   │   │   self._task_info[idx] += (data,)                                           │
│   1331 │   │   │   else:                                                                         │
│   1332 │   │   │   │   del self._task_info[idx]                                                  │
│ ❱ 1333 │   │   │   │   return self._process_data(data)                                           │
│   1334 │                                                                                         │
│   1335 │   def _try_put_index(self):                                                             │
│   1336 │   │   assert self._tasks_outstanding < self._prefetch_factor * self._num_workers        │
│                                                                                                  │
│ C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\utils\data\dataloader.py:1359  │
│ in _process_data                                                                                 │
│                                                                                                  │
│   1356 │   │   self._rcvd_idx += 1                                                               │
│   1357 │   │   self._try_put_index()                                                             │
│   1358 │   │   if isinstance(data, ExceptionWrapper):                                            │
│ ❱ 1359 │   │   │   data.reraise()                                                                │
│   1360 │   │   return data                                                                       │
│   1361 │                                                                                         │
│   1362 │   def _mark_worker_as_unavailable(self, worker_id, shutdown=False):                     │
│                                                                                                  │
│ C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\_utils.py:543 in reraise       │
│                                                                                                  │
│   540 │   │   │   # If the exception takes multiple arguments, don't try to                      │
│   541 │   │   │   # instantiate since we don't know how to                                       │
│   542 │   │   │   raise RuntimeError(msg) from None                                              │
│ ❱ 543 │   │   raise exception                                                                    │
│   544                                                                                            │
│   545                                                                                            │
│   546 def _get_available_device_type():                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\utils\data\_utils\worker.py", line 302, in
_worker_loop
    data = fetcher.fetch(index)
  File "C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\utils\data\_utils\fetch.py", line 58, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\utils\data\_utils\fetch.py", line 58, in
<listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\Lucas\anaconda3\envs\animatediff\lib\site-packages\torch\utils\data\dataset.py", line 240, in
__getitem__
    return self.datasets[dataset_idx][sample_idx]
  File "I:\AnimateDiff-MotionDirector\animatediff\utils\dataset.py", line 460, in __getitem__
    video, prompt, prompt_ids = self.single_video_batch(index)
  File "I:\AnimateDiff-MotionDirector\animatediff\utils\dataset.py", line 443, in single_video_batch
    video, _ = self.process_video_wrapper(train_data)
  File "I:\AnimateDiff-MotionDirector\animatediff\utils\dataset.py", line 145, in process_video_wrapper
    video, vr = process_video(
  File "I:\AnimateDiff-MotionDirector\animatediff\utils\dataset.py", line 92, in process_video
    resize, height, width = get_frame_buckets(vr)
  File "I:\AnimateDiff-MotionDirector\animatediff\utils\dataset.py", line 136, in get_frame_buckets
    interpolation=torchvision.transforms.InterpolationMode.NEAREST_EXACT
  File "C:\Users\Lucas\anaconda3\envs\animatediff\lib\enum.py", line 437, in __getattr__
    raise AttributeError(name) from None
AttributeError: NEAREST_EXACT```
Had some trouble with the repo but i'm not sure whats wrong here, changing the video source gives me a different error.
@Cubey42
Copy link
Author

Cubey42 commented Feb 4, 2024

if I try a different video I get ```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ I:\AnimateDiff-MotionDirector\train.py:1038 in │
│ │
│ 1035 │ if getattr(config, "simple_mode", False): │
│ 1036 │ │ config = get_simple_config(config) │
│ 1037 │ │
│ ❱ 1038 │ main(name=name, use_wandb=args.wandb, **config) │
│ 1039 │
│ │
│ I:\AnimateDiff-MotionDirector\train.py:713 in main │
│ │
│ 710 │ num_update_steps_per_epoch = math.ceil(len(train_dataloader) / gradient_accumulation │
│ 711 │ │
│ 712 │ # Afterwards we recalculate our number of training epochs │
│ ❱ 713 │ num_train_epochs = math.ceil(max_train_steps / num_update_steps_per_epoch) │
│ 714 │ │
│ 715 │ # Train! │
│ 716 │ total_batch_size = train_batch_size * num_processes * gradient_accumulation_steps │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ZeroDivisionError: division by zero

@ExponentialML
Copy link
Owner

Hi. I'm currently in the process to porting everything to the latest diffusers version.

This PR should work for you. #7

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