Skip to content

[BUG]: AttributeError: 'LlamaActor' object has no attribute 'resize_token_embeddings' #3639

@ZhangMaoTai

Description

@ZhangMaoTai

🐛 Describe the bug

When run the Stage3 code https://github.com/hpcaitech/ColossalAI/blob/main/applications/Chat/examples/train_prompts.py using LLaMA, this bug is encountered in line 137:
tokenizer = prepare_llama_tokenizer_and_embedding(tokenizer, actor)

The detailed of this bug:

Traceback (most recent call last):
  File "experience.py", line 183, in <module>
    tokenizer = prepare_llama_tokenizer_and_embedding(tokenizer, actor)
  File "/XXX/XXX/ColossalAI/applications/Chat/coati/utils/tokenizer_utils.py", line 37, in prepare_llama_tokenizer_and_embedding
    smart_tokenizer_and_embedding_resize(
  File "/XXX/XXX/ColossalAI/applications/Chat/coati/utils/tokenizer_utils.py", line 68, in smart_tokenizer_and_embedding_resize
    model.resize_token_embeddings(len(tokenizer))
  File "/root/anaconda3/envs/coati/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1269, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'LlamaActor' object has no attribute 'resize_token_embeddings'

This bug is the same as this one: #3389

Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions