Skip to content

AttributeError: 'MolmoForCausalLM' object has no attribute 'all_tied_weights_keys' #43883

Description

@Kaihui-intel

System Info

transformers==5.1.0

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

code

from transformers import AutoModelForCausalLM
model_name = "allenai/Molmo-7B-D-0924"
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", trust_remote_code=True)

error

../../.local/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py:365: in from_pretrained
    return model_class.from_pretrained(
../../.local/lib/python3.11/site-packages/transformers/modeling_utils.py:4110: in from_pretrained
    load_info = cls._finalize_load_state_dict(model, load_config, load_info)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../.local/lib/python3.11/site-packages/transformers/modeling_utils.py:4264: in _finalize_load_state_dict
    model.mark_tied_weights_as_initialized()
../../.local/lib/python3.11/site-packages/transformers/modeling_utils.py:4587: in mark_tied_weights_as_initialized
    for tied_param in self.all_tied_weights_keys.keys():
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = MolmoForCausalLM(
  (model): Molmo(
    (transformer): ModuleDict(
      (wte): Embedding()
      (emb_drop): Dropout(...ropout): Dropout(p=0.0, inplace=False)
      )
      (image_feature_dropout): Dropout(p=0.0, inplace=False)
    )
  )
)
name = 'all_tied_weights_keys'

    def __getattr__(self, name: str) -> Union[Tensor, "Module"]:
        if "_parameters" in self.__dict__:
            _parameters = self.__dict__["_parameters"]
            if name in _parameters:
                return _parameters[name]
        if "_buffers" in self.__dict__:
            _buffers = self.__dict__["_buffers"]
            if name in _buffers:
                return _buffers[name]
        if "_modules" in self.__dict__:
            modules = self.__dict__["_modules"]
            if name in modules:
                return modules[name]
>       raise AttributeError(
            f"'{type(self).__name__}' object has no attribute '{name}'"
        )
E       AttributeError: 'MolmoForCausalLM' object has no attribute 'all_tied_weights_keys'

../../miniforge3/envs/py311/lib/python3.11/site-packages/torch/nn/modules/module.py:1964: AttributeError

Expected behavior

The code should be work.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions