Skip to content

Error while inferencing #11

@ra-MANUJ-an

Description

@ra-MANUJ-an

Hi @avidale While using the gedi_inference notebook, I'm experiencing the following error:

AttributeError: 'GediAdapter' object has no attribute 'can_generate'

Is there a solution for how to work around this problem?

I'm using : from transformers import GenerationMixin
instead of : from transformers.generation_utils import GenerationMixin

Complete error log is as follows:

====BEFORE====
The internal policy of Trump is flawed.
====AFTER=====
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File <timed exec>:7

File ~/second/lib/python3.11/site-packages/torch/utils/_contextlib.py:115, in context_decorator.<locals>.decorate_context(*args, **kwargs)
    112 @functools.wraps(func)
    113 def decorate_context(*args, **kwargs):
    114     with ctx_factory():
--> 115         return func(*args, **kwargs)

File ~/second/lib/python3.11/site-packages/transformers/generation/utils.py:1408, in GenerationMixin.generate(self, inputs, generation_config, logits_processor, stopping_criteria, prefix_allowed_tokens_fn, synced_gpus, assistant_model, streamer, negative_prompt_ids, negative_prompt_attention_mask, **kwargs)
   1405         synced_gpus = False
   1407 # 1. Handle `generation_config` and kwargs that might update it, and validate the `.generate()` call
-> 1408 self._validate_model_class()
   1410 # priority: `generation_config` argument > `model.generation_config` (the default generation config)
   1411 if generation_config is None:
   1412     # legacy: users may modify the model configuration to control generation -- update the generation config
   1413     # model attribute accordingly, if it was created from the model config

File ~/second/lib/python3.11/site-packages/transformers/generation/utils.py:1184, in GenerationMixin._validate_model_class(self)
   1179 def _validate_model_class(self):
   1180     """
   1181     Confirms that the model class is compatible with generation. If not, raises an exception that points to the
   1182     right class to use.
   1183     """
-> 1184     if not self.can_generate():
   1185         generate_compatible_mappings = [
   1186             MODEL_FOR_CAUSAL_LM_MAPPING,
   1187             MODEL_FOR_CAUSAL_IMAGE_MODELING_MAPPING,
   (...)
   1190             MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING,
   1191         ]
   1192         generate_compatible_classes = set()

AttributeError: 'GediAdapter' object has no attribute 'can_generate'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions