When I using the chat_template of llama 2 tokenizer the response of IT model is nothing

My model was instruction data follow the template blow, I can try to generate some answer but the answer always return repeated of question without answer.
There is my code :

import torch

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# from peft import PeftModel, PeftConfig

from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("/data/tqlong/project_gamma/Son/mem/checkpoint-9600", trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained("/data/tqlong/project_gamma/Son/mem/checkpoint-9600", trust_remote_code=True).to(device)

EOS_TOKEN = tokenizer.eos_token
def format_prompt(prompt):
    text = [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": prompt},
    ]
    mess = tokenizer.apply_chat_template(text, tokenize=False) + EOS_TOKEN
    return mess

def generate(prompt, tokenizer, max_new_tokens):
    text = format_prompt(prompt)
    text += "\n<|im_start|>assistant\n"
    input_ids = tokenizer(text, return_tensors="pt", truncation=True).input_ids.cuda()
    outputs = model.generate(input_ids=input_ids, max_new_tokens=max_new_tokens,
                             do_sample=False,pad_token_id=tokenizer.pad_token_id,
                             forced_eos_token_id=tokenizer.eos_token_id)
    outputs = outputs[0].tolist()
    # Stop decoding when hitting the EOS token
    return tokenizer.decode(outputs)
    
text = """Who is Bill Gates ?"""
print(generate(text, tokenizer, 256))

The model is ELM and the tokenizer is llama-2

And the answer is :

<s><s> [INST] <<SYS>>
You are a helpful assistant.
<</SYS>>

Who is Bill Gates [/INST]</s> 
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start|>assistant
<|im_end|>

You are a helpful assistant.
<|im_start</s>

I don’t know how to sovle my problem. Please help me!!
Thank you