ModuleNotFoundError: Could not import module 'DiffusionGemmaForBlockDiffusion'. Are this object's requirements defined correctly?

#2
by Phase-Technologies - opened

I've updated to new version of transformers & accelerate and restarted runtime but this error came pls help


RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.12/dist-packages/transformers/utils/import_utils.py in getattr(self, name)
2261 try:
-> 2262 module = self._get_module(self._class_to_module[name])
2263 value = getattr(module, name)

19 frames/usr/local/lib/python3.12/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
2495 except Exception as e:
-> 2496 raise e
2497

/usr/local/lib/python3.12/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
2493 try:
-> 2494 return importlib.import_module("." + module_name, self.name)
2495 except Exception as e:

/usr/lib/python3.12/importlib/init.py in import_module(name, package)
89 level += 1
---> 90 return _bootstrap._gcd_import(name[level:], package, level)
91

/usr/lib/python3.12/importlib/_bootstrap.py in _gcd_import(name, package, level)

/usr/lib/python3.12/importlib/_bootstrap.py in find_and_load(name, import)

/usr/lib/python3.12/importlib/_bootstrap.py in find_and_load_unlocked(name, import)

/usr/lib/python3.12/importlib/_bootstrap.py in _load_unlocked(spec)

/usr/lib/python3.12/importlib/_bootstrap_external.py in exec_module(self, module)

/usr/lib/python3.12/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

/usr/local/lib/python3.12/dist-packages/transformers/models/diffusion_gemma/modeling_diffusion_gemma.py in
33 from ...modeling_flash_attention_utils import FlashAttentionKwargs
---> 34 from ...modeling_layers import GradientCheckpointingLayer
35 from ...modeling_outputs import (

/usr/local/lib/python3.12/dist-packages/transformers/modeling_layers.py in
26 from .models.auto import AutoModel
---> 27 from .processing_utils import Unpack
28 from .utils import TransformersKwargs, auto_docstring, can_return_tuple, logging

/usr/local/lib/python3.12/dist-packages/transformers/processing_utils.py in
39 from .feature_extraction_utils import BatchFeature
---> 40 from .image_utils import ChannelDimension, ImageInput, is_vision_available, make_flat_list_of_images
41 from .tokenization_utils_base import (

/usr/local/lib/python3.12/dist-packages/transformers/image_utils.py in
53 if is_torchvision_available():
---> 54 from torchvision.io import ImageReadMode, decode_image
55 from torchvision.transforms import InterpolationMode

/usr/local/lib/python3.12/dist-packages/torchvision/init.py in
7 from . import extension # usort:skip # noqa: F401
----> 8 from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip
9

/usr/local/lib/python3.12/dist-packages/torchvision/_meta_registrations.py in
162
--> 163 @torch .library.register_fake("torchvision::nms")
164 def meta_nms(dets, scores, iou_threshold):

/usr/local/lib/python3.12/dist-packages/torch/library.py in register(func)
1084 use_lib = lib
-> 1085 use_lib._register_fake(
1086 op_name, func, _stacklevel=stacklevel + 1, allow_override=allow_override

/usr/local/lib/python3.12/dist-packages/torch/library.py in _register_fake(self, op_name, fn, _stacklevel, allow_override)
201
--> 202 handle = entry.fake_impl.register(
203 func_to_register, source, lib=self, allow_override=allow_override

/usr/local/lib/python3.12/dist-packages/torch/_library/fake_impl.py in register(self, func, source, lib, allow_override)
49 )
---> 50 if torch._C._dispatch_has_kernel_for_dispatch_key(self.qualname, "Meta"):
51 raise RuntimeError(

RuntimeError: operator torchvision::nms does not exist

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

ModuleNotFoundError Traceback (most recent call last)
/tmp/ipykernel_12943/2344719202.py in <cell line: 0>()
----> 1 from transformers import DiffusionGemmaForBlockDiffusion, AutoProcessor
2
3 MODEL_ID = "google/diffusiongemma-26B-A4B-it"
4
5 # Load model

/usr/local/lib/python3.12/dist-packages/transformers/utils/import_utils.py in getattr(self, name)
2348 ) from e
2349 else:
-> 2350 raise ModuleNotFoundError(
2351 f"Could not import module '{name}'. Are this object's requirements defined correctly?"
2352 ) from e

ModuleNotFoundError: Could not import module 'DiffusionGemmaForBlockDiffusion'. Are this object's requirements defined correctly?


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

Open Examples

Hi @Phase-Technologies ,

Thanks for addressing the issue. We have tested the google/diffusiongemma-26B-A4B-it notebook with the latest transformers version 5.11.0 using "pip install -U transformers" and code ran successfully without any errors. Please refer to the gist.

Could you help us debug further by sharing the following details:

  1. Your exact transformer version, how exactly you installed transformers?
  2. Was it pip install -U transformers or any specific version.

Even i face the same issue i have the latest transformers with version as 5.11.x but still the DiffusionGemmaForBlcokDiffusion is not found

image

You can try pip install git+https://github.com/huggingface/transformers . This is helping.

the problem has been resolved, thanks

Sign up or log in to comment