Skip to content

运行时报错AttributeError: 'MiMoAudioForCausalLM' object has no attribute '_prepare_generation_config' #48

@LJH-LBJ

Description

@LJH-LBJ

运行时报错AttributeError: 'MiMoAudioForCausalLM' object has no attribute '_prepare_generation_config' 此issue的方法无法解决
尝试过以下方法都不行

sentence-transformers              5.3.0
transformers                       4.49.0
sentence-transformers              5.3.0
transformers                       4.53.0
`torch_dtype` is deprecated! Use `dtype` instead!
MiMoAudioForCausalLM has generative capabilities, as `prepare_inputs_for_generation` is explicitly defined. However, it doesn't directly inherit from `GenerationMixin`. From 👉v4.50👈 onwards, `PreTrainedModel` will NOT inherit from `GenerationMixin`, and this model will lose the ability to call `generate` and other related functions.
  - If you're using `trust_remote_code=True`, you can get rid of this warning by loading the model with an auto class. See https://huggingface.co/docs/transformers/en/model_doc/auto#auto-classes
  - If you are the owner of the model architecture code, please modify your model class such that it inherits from `GenerationMixin` (after `PreTrainedModel`, otherwise you'll get an exception).
  - If you are not the owner of the model architecture class, please contact the model code owner to update it.
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:03<00:00,  1.09it/s]
MiMoAudioForCausalLM has generative capabilities, as `prepare_inputs_for_generation` is explicitly defined. However, it doesn't directly inherit from `GenerationMixin`. From 👉v4.50👈 onwards, `PreTrainedModel` will NOT inherit from `GenerationMixin`, and this model will lose the ability to call `generate` and other related functions.
  - If you're using `trust_remote_code=True`, you can get rid of this warning by loading the model with an auto class. See https://huggingface.co/docs/transformers/en/model_doc/auto#auto-classes
  - If you are the owner of the model architecture code, please modify your model class such that it inherits from `GenerationMixin` (after `PreTrainedModel`, otherwise you'll get an exception).
  - If you are not the owner of the model architecture class, please contact the model code owner to update it.
MiMoAudioForCausalLM has generative capabilities, as `prepare_inputs_for_generation` is explicitly defined. However, it doesn't directly inherit from `GenerationMixin`. From 👉v4.50👈 onwards, `PreTrainedModel` will NOT inherit from `GenerationMixin`, and this model will lose the ability to call `generate` and other related functions.
  - If you're using `trust_remote_code=True`, you can get rid of this warning by loading the model with an auto class. See https://huggingface.co/docs/transformers/en/model_doc/auto#auto-classes
  - If you are the owner of the model architecture code, please modify your model class such that it inherits from `GenerationMixin` (after `PreTrainedModel`, otherwise you'll get an exception).
  - If you are not the owner of the model architecture class, please contact the model code owner to update it.
Model loaded in 7.66 seconds, device: cuda
MiMo-Audio Tokenizer loaded in 13.06 seconds, device: cuda
Traceback (most recent call last):
  File "/home/l00807937/vllm-omni/MiMo-Audio/inference_example_sft.py", line 14, in <module>
    text_channel_output = model.tts_sft(text, output_audio_path)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/l00807937/vllm-omni/MiMo-Audio/src/mimo_audio/mimo_audio.py", line 1185, in tts_sft
    text_output = self.forward(input_ids, output_audio_path=output_path, stopping_criteria=stopping_criteria, task_name="tts")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/l00807937/sglang/sglang/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/l00807937/vllm-omni/MiMo-Audio/src/mimo_audio/mimo_audio.py", line 1096, in forward
    generated_ids = self.model.generate(
                    ^^^^^^^^^^^^^^^^^^^^
  File "/home/l00807937/sglang/sglang/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/l00807937/vllm-omni/MiMo-Audio/src/mimo_audio/modeling_mimo_audio.py", line 659, in generate
    generation_config, model_kwargs = self._prepare_generation_config(
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


  File "/home/l00807937/sglang/sglang/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1964, in __getattr__
    raise AttributeError(
AttributeError: 'MiMoAudioForCausalLM' object has no attribute '_prepare_generation_config'

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