Skip to content

AttributeError: 'LlamaForCausalLM' object has no attribute 'to_hf' #9

@XIAO4579

Description

@XIAO4579

I think that pallava/model.py lack the "to_hf" function. Could you please upload the whole file of the model.py?

Reconstructed state dict with 548 params 381222912 elements
Load State Dict: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 549/549 [00:00<00:00, 2651.60it/s]
03/29 13:12:08 - mmengine - INFO - Load PTH model from /home/model/Pathology-LLaVA/domain_alignment_weight.pth
Traceback (most recent call last):
File "/home/xtuner/pallava/model.py", line 459, in getattr
return super().getattr(name)
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1931, in getattr
raise AttributeError(
AttributeError: 'LLaVAModel' object has no attribute 'to_hf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/peft/peft_model.py", line 793, in getattr
return super().getattr(name) # defer to nn.Module's logic
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1931, in getattr
raise AttributeError(
AttributeError: 'PeftModelForCausalLM' object has no attribute 'to_hf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/peft/tuners/lora/model.py", line 359, in getattr
return super().getattr(name) # defer to nn.Module's logic
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1931, in getattr
raise AttributeError(
AttributeError: 'LoraModel' object has no attribute 'to_hf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/xtuner/xtuner/tools/model_converters/pth_to_hf.py", line 139, in
main()
File "/home/xtuner/xtuner/tools/model_converters/pth_to_hf.py", line 127, in main
model.to_hf(
File "/home/xtuner/pallava/model.py", line 461, in getattr
return getattr(self.llm, name)
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/peft/peft_model.py", line 797, in getattr
return getattr(self.base_model, name)
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/peft/tuners/lora/model.py", line 363, in getattr
return getattr(self.model, name)
File "/home/miniforge3/envs/xtuner-env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1931, in getattr
raise AttributeError(
AttributeError: 'LlamaForCausalLM' object has no attribute 'to_hf'

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