'GemmaForCausalLM' object has no attribute 'chat'
Author: liangDarwin2
Pull request: no

### System Info

`response, history = model.chat(tokenizer, input_text, history=history)
    print("Assistant: {}".format(response))`

leading to the following error:

(torch) [lianggq@g02 finetune]$ python infer.py 
Loading checkpoint shards: 100%|████████████████████████████████████████████| 2/2 [00:10<00:00,  5.33s/it]
User: hi
Traceback (most recent call last):
  File "/home/lianggq/miniconda3/envs/glm/lib/python3.10/site-packages/peft/peft_model.py", line 529, in __getattr__
    return super().__getattr__(name)  # defer to nn.Module's logic
  File "/home/lianggq/miniconda3/envs/glm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1688, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'PeftModelForCausalLM' object has no attribute 'chat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lianggq/miniconda3/envs/glm/lib/python3.10/site-packages/peft/tuners/lora/model.py", line 273, in __getattr__
    return super().__getattr__(name)  # defer to nn.Module's logic
  File "/home/lianggq/miniconda3/envs/glm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1688, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'LoraModel' object has no attribute 'chat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lianggq/finetune_v2/Qwen/finetune/infer.py", line 28, in <module>
    response, history = model.chat(tokenizer, input_text, history=history)
  File "/home/lianggq/miniconda3/envs/glm/lib/python3.10/site-packages/peft/peft_model.py", line 531, in __getattr__
    return getattr(self.base_model, name)
  File "/home/lianggq/miniconda3/envs/glm/lib/python3.10/site-packages/peft/tuners/lora/model.py", line 275, in __getattr__
    return getattr(self.model, name)
  File "/home/lianggq/miniconda3/envs/glm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1688, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'GemmaForCausalLM' object has no attribute 'chat'

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [x] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [x] My own task or dataset (give details below)

### Reproduction

1、use lora to finetune gemma-2b-it
2、
`model = AutoPeftModelForCausalLM.from_pretrained(
    'output_dir',
    device_map="auto",
    trust_remote_code=True
).eval()`

3、`response, history = model.chat(tokenizer, input_text, history=history)
    print("Assistant: {}".format(response))`

### Expected behavior

return a chat completion

Comments:
No models in transformers have `chat` function, are you looking for `agent.chat("Generate a picture of rivers and lakes")`. This leverages the `agents` not a model. Closing as this is expected