Skip to content

Error in prepare model for training - AttributeError: 'CastOutputToFloat' object has no attribute 'weight' #1

@sofpast

Description

@sofpast

I run the fil 1. Efficiently_train_Large_Language_Models_with_LoRA_and_Hugging_Face.ipynb and in step "Now, we can prepare our model for the LoRA int-8 training using peft." I got following error. Can you tell me what's going on?

I am running on Google Colab and here is what I have:

+-----------------------------------------------------------------------------+ | NVIDIA-SMI 525.105.17 Driver Version: 525.105.17 CUDA Version: 12.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA A100-SXM... Off | 00000000:00:04.0 Off | 0 | | N/A 33C P0 52W / 400W | 18393MiB / 40960MiB | 0% Default | | | | Disabled |

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <cell line: 13>:13                                                                            │
│                                                                                                  │
│ /usr/local/lib/python3.10/dist-packages/peft/utils/other.py:72 in                                │
│ prepare_model_for_int8_training                                                                  │
│                                                                                                  │
│    69 │                                                                                          │
│    70 │   if hasattr(model, output_embedding_layer_name):                                        │
│    71 │   │   output_embedding_layer = getattr(model, output_embedding_layer_name)               │
│ ❱  72 │   │   input_dtype = output_embedding_layer.weight.dtype                                  │
│    73 │   │                                                                                      │
│    74 │   │   class CastOutputToFloat(torch.nn.Sequential):                                      │
│    75 │   │   │   r"""                                                                           │
│                                                                                                  │
│ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1614 in __getattr__           │
│                                                                                                  │
│   1611 │   │   │   modules = self.__dict__['_modules']                                           │
│   1612 │   │   │   if name in modules:                                                           │
│   1613 │   │   │   │   return modules[name]                                                      │
│ ❱ 1614 │   │   raise AttributeError("'{}' object has no attribute '{}'".format(                  │
│   1615 │   │   │   type(self).__name__, name))                                                   │
│   1616 │                                                                                         │
│   1617 │   def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'CastOutputToFloat' object has no attribute 'weight'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions