code llama prompt template

#19
by johnhk - opened

is there a way to find code llama prompt template? I found one like
[INST] Write code to solve the following coding problem that obeys the constraints and passes the example test cases. Please wrap your code answer using ```:
{prompt}
[/INST], so I'm curious is there a set of prompt templates designed for codellama to carry out different tasks more efficiently

I'm also curious about the specialized tag like[INST] that code llama use, how to find more such tags

The following tags are used in the original repository.

codellama/llama/generation.py

B_INST, E_INST = "[INST]", "[/INST]"
B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"

SPECIAL_TAGS = [B_INST, E_INST, "<<SYS>>", "<</SYS>>"]
Code Llama org

The conversational instructions follow the same format as Llama 2. Here's a template that shows the structure when you use a system prompt (which is optional) followed by several rounds of user instructions and model answers. The easiest way to ensure you adhere to that format is by using the new "Chat Templates" feature in transformers, which will take care of the delimiters for you: https://huggingface.co./docs/transformers/chat_templating

In addition to interfacing with the model using chat conversations, you can also ask it to fill a block of code with a suitable completion, which is what some code assistant tools do. To use this interaction mode, I'd recommend you follow the Code Infilling section of this blog post.

I use following template for finetuning and inference:

<s>[INST] user_message_1 [/INST] response_1 </s><s>[INST] user_message_2 [/INST] response_2 </s>

Are you able to recover the performance on mbpp and human eval as mentioned in the paper
I have been trying to use the big code evaluation harness framework to recover the performance which I am not able to do so far.

Sign up or log in to comment