SenseLLM/ReflectionCoder-CL-7B
ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation
<p align="center"> <a href="https://arxiv.org/abs/2405.17057">๐ Paper</a> โข <a href="https://github.com/SenseLLM/ReflectionCoder">๐ Repo</a> โข <a href="https://huggingface.co/SenseLLM/ReflectionCoder-DS-33B">๐ค Models</a> โข <a href="https://huggingface.co/datasets/SenseLLM/ReflectionSeq-GPT">๐ Datasets </a> </p>
Introduction
ReflectionCoder is a novel approach that effectively leverages reflection sequences constructed by integrating compiler feedback to improve one-off code generation performance. Please refer to our paper and repo for more details!
<hr>
Models
Datasets
How to Use
Chat Format
Following chat templates of most models, we use two special tokens to wrap the message of user and assistant, i.e., `<|user|>, <|assistant|>, and <|endofmessage|>. Furthermore, we use two special tokens to wrap the content of different blocks, *i.e.*, <|text|> and <|endofblock|>`. You can use the following code to prompt our ReflectionCoder.
import torch
from transformers import pipeline
chat = [
{"role": "user", "content": "<Your code instruction here>"}
]
generator = pipeline(
model="SenseLLM/ReflectionCoder-CL-7B",
task="text-generation",
torch_dtype=torch.bfloat16,
device_map="auto",
)
result = generator(chat, max_length=128, num_return_sequences=1)
print(result)Please refer to our GitHub Repo for more technical details.
Citation
If you find this repo useful for your research, please kindly cite our paper:
@misc{ren2024reflectioncoder,
title={ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation},
author={Houxing Ren and Mingjie Zhan and Zhongyuan Wu and Aojun Zhou and Junting Pan and Hongsheng Li},
year={2024},
eprint={2405.17057},
archivePrefix={arXiv},
primaryClass={cs.CL}
}Acknowledgments
We thank the following amazing projects that truly inspired us:
