dmarx / video-killed-the-radio-star

Notebook and tools for end-to-end automation of music video production with generative AI
https://colab.research.google.com/github/dmarx/video-killed-the-radio-star/blob/main/Video_Killed_The_Radio_Star_Defusion.ipynb#scrollTo=oPbeyWtesAoh
MIT License
196 stars 35 forks source link

transformers throwing weird protobuf error #124

Closed dmarx closed 1 year ago

dmarx commented 1 year ago

probably need to version-pin protobuf, transformers, or both.

<ipython-input-1-69565f39794a>:17: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)
  from tqdm.autonotebook import tqdm
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py:1126 in _get_module    │
│                                                                                                  │
│   1123 │                                                                                         │
│   1124 │   def _get_module(self, module_name: str):                                              │
│   1125 │   │   try:                                                                              │
│ ❱ 1126 │   │   │   return importlib.import_module("." + module_name, self.__name__)              │
│   1127 │   │   except Exception as e:                                                            │
│   1128 │   │   │   raise RuntimeError(                                                           │
│   1129 │   │   │   │   f"Failed to import {self.__name__}.{module_name} because of the followin  │
│                                                                                                  │
│ /usr/lib/python3.9/importlib/__init__.py:127 in import_module                                    │
│                                                                                                  │
│   124 │   │   │   if character != '.':                                                           │
│   125 │   │   │   │   break                                                                      │
│   126 │   │   │   level += 1                                                                     │
│ ❱ 127 │   return _bootstrap._gcd_import(name[level:], package, level)                            │
│   128                                                                                            │
│   129                                                                                            │
│   130 _RELOADING = {}                                                                            │
│ in _gcd_import:1030                                                                              │
│ in _find_and_load:1007                                                                           │
│ in _find_and_load_unlocked:986                                                                   │
│ in _load_unlocked:680                                                                            │
│ in exec_module:850                                                                               │
│ in _call_with_frames_removed:228                                                                 │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/transformers/models/clip/feature_extraction_clip.py:20 in │
│ <module>                                                                                         │
│                                                                                                  │
│   17 import warnings                                                                             │
│   18                                                                                             │
│   19 from ...utils import logging                                                                │
│ ❱ 20 from .image_processing_clip import CLIPImageProcessor                                       │
│   21                                                                                             │
│   22                                                                                             │
│   23 logger = logging.get_logger(__name__)                                                       │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/transformers/models/clip/image_processing_clip.py:22 in   │
│ <module>                                                                                         │
│                                                                                                  │
│    19 import numpy as np                                                                         │
│    20                                                                                            │
│    21 from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict      │
│ ❱  22 from ...image_transforms import (                                                          │
│    23 │   center_crop,                                                                           │
│    24 │   convert_to_rgb,                                                                        │
│    25 │   get_resize_output_image_size,                                                          │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/transformers/image_transforms.py:48 in <module>           │
│                                                                                                  │
│    45 │   import torch                                                                           │
│    46                                                                                            │
│    47 if is_tf_available():                                                                      │
│ ❱  48 │   import tensorflow as tf                                                                │
│    49                                                                                            │
│    50 if is_flax_available():                                                                    │
│    51 │   import jax.numpy as jnp                                                                │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/tensorflow/__init__.py:37 in <module>                     │
│                                                                                                  │
│    34 import sys as _sys                                                                         │
│    35 import typing as _typing                                                                   │
│    36                                                                                            │
│ ❱  37 from tensorflow.python.tools import module_util as _module_util                            │
│    38 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader                   │
│    39                                                                                            │
│    40 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.           │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/tensorflow/python/__init__.py:37 in <module>              │
│                                                                                                  │
│    34 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top                   │
│    35                                                                                            │
│    36 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow                      │
│ ❱  37 from tensorflow.python.eager import context                                                │
│    38                                                                                            │
│    39 # pylint: enable=wildcard-import                                                           │
│    40                                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/tensorflow/python/eager/context.py:28 in <module>         │
│                                                                                                  │
│     25 from absl import logging                                                                  │
│     26 import numpy as np                                                                        │
│     27                                                                                           │
│ ❱   28 from tensorflow.core.framework import function_pb2                                        │
│     29 from tensorflow.core.protobuf import config_pb2                                           │
│     30 from tensorflow.core.protobuf import rewriter_config_pb2                                  │
│     31 from tensorflow.python import pywrap_tfe                                                  │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/tensorflow/core/framework/function_pb2.py:5 in <module>   │
│                                                                                                  │
│    2 # Generated by the protocol buffer compiler.  DO NOT EDIT!                                  │
│    3 # source: tensorflow/core/framework/function.proto                                          │
│    4 """Generated protocol buffer code."""                                                       │
│ ❱  5 from google.protobuf.internal import builder as _builder                                    │
│    6 from google.protobuf import descriptor as _descriptor                                       │
│    7 from google.protobuf import descriptor_pool as _descriptor_pool                             │
│    8 from google.protobuf import symbol_database as _symbol_database                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'builder' from 'google.protobuf.internal' 
(/usr/local/lib/python3.9/dist-packages/google/protobuf/internal/__init__.py)

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

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <cell line: 76>:79                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/vktrs/hf.py:4 in <module>                                 │
│                                                                                                  │
│    1 from pathlib import Path                                                                    │
│    2 import torch                                                                                │
│    3 from torch import autocast                                                                  │
│ ❱  4 from diffusers import (                                                                     │
│    5 │   StableDiffusionImg2ImgPipeline,                                                         │
│    6 │   StableDiffusionPipeline,                                                                │
│    7 )                                                                                           │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/diffusers/__init__.py:55 in <module>                      │
│                                                                                                  │
│    52 │   │   get_polynomial_decay_schedule_with_warmup,                                         │
│    53 │   │   get_scheduler,                                                                     │
│    54 │   )                                                                                      │
│ ❱  55 │   from .pipelines import (                                                               │
│    56 │   │   AudioPipelineOutput,                                                               │
│    57 │   │   DanceDiffusionPipeline,                                                            │
│    58 │   │   DDIMPipeline,                                                                      │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/diffusers/pipelines/__init__.py:44 in <module>            │
│                                                                                                  │
│    41 except OptionalDependencyNotAvailable:                                                     │
│    42 │   from ..utils.dummy_torch_and_transformers_objects import *  # noqa F403                │
│    43 else:                                                                                      │
│ ❱  44 │   from .alt_diffusion import AltDiffusionImg2ImgPipeline, AltDiffusionPipeline           │
│    45 │   from .latent_diffusion import LDMTextToImagePipeline                                   │
│    46 │   from .paint_by_example import PaintByExamplePipeline                                   │
│    47 │   from .semantic_stable_diffusion import SemanticStableDiffusionPipeline                 │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/diffusers/pipelines/alt_diffusion/__init__.py:32 in       │
│ <module>                                                                                         │
│                                                                                                  │
│   29                                                                                             │
│   30 if is_transformers_available() and is_torch_available():                                    │
│   31 │   from .modeling_roberta_series import RobertaSeriesModelWithTransformation               │
│ ❱ 32 │   from .pipeline_alt_diffusion import AltDiffusionPipeline                                │
│   33 │   from .pipeline_alt_diffusion_img2img import AltDiffusionImg2ImgPipeline                 │
│   34                                                                                             │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion. │
│ py:20 in <module>                                                                                │
│                                                                                                  │
│    17                                                                                            │
│    18 import torch                                                                               │
│    19 from packaging import version                                                              │
│ ❱  20 from transformers import CLIPFeatureExtractor, XLMRobertaTokenizer                         │
│    21                                                                                            │
│    22 from diffusers.utils import is_accelerate_available, is_accelerate_version                 │
│    23                                                                                            │
│ in _handle_fromlist:1055                                                                         │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py:1117 in __getattr__    │
│                                                                                                  │
│   1114 │   │   │   value = self._get_module(name)                                                │
│   1115 │   │   elif name in self._class_to_module.keys():                                        │
│   1116 │   │   │   module = self._get_module(self._class_to_module[name])                        │
│ ❱ 1117 │   │   │   value = getattr(module, name)                                                 │
│   1118 │   │   else:                                                                             │
│   1119 │   │   │   raise AttributeError(f"module {self.__name__} has no attribute {name}")       │
│   1120                                                                                           │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py:1116 in __getattr__    │
│                                                                                                  │
│   1113 │   │   if name in self._modules:                                                         │
│   1114 │   │   │   value = self._get_module(name)                                                │
│   1115 │   │   elif name in self._class_to_module.keys():                                        │
│ ❱ 1116 │   │   │   module = self._get_module(self._class_to_module[name])                        │
│   1117 │   │   │   value = getattr(module, name)                                                 │
│   1118 │   │   else:                                                                             │
│   1119 │   │   │   raise AttributeError(f"module {self.__name__} has no attribute {name}")       │
│                                                                                                  │
│ /usr/local/lib/python3.9/dist-packages/transformers/utils/import_utils.py:1128 in _get_module    │
│                                                                                                  │
│   1125 │   │   try:                                                                              │
│   1126 │   │   │   return importlib.import_module("." + module_name, self.__name__)              │
│   1127 │   │   except Exception as e:                                                            │
│ ❱ 1128 │   │   │   raise RuntimeError(                                                           │
│   1129 │   │   │   │   f"Failed to import {self.__name__}.{module_name} because of the followin  │
│   1130 │   │   │   │   f" traceback):\n{e}"                                                      │
│   1131 │   │   │   ) from e                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: Failed to import transformers.models.clip.feature_extraction_clip because of the following error 
(look up to see its traceback):
cannot import name 'builder' from 'google.protobuf.internal' 
(/usr/local/lib/python3.9/dist-packages/google/protobuf/internal/__init__.py)