Cesterqwen is a fine-tuned Qwen2.5-1.5B model that is able to generate Libcester unit test cases in the correct format.
The model often regenerates the input prompt in the output. This can lead to limited test cases being printed due to truncations based on max_new_tokens.
Expanding the dataset will help increase the accuracy and robustness of the model, and improve code coverage based on real life scenarios.
Use the code below to get started with the model.
1from transformers import AutoModelForCausalLM, Qwen2Tokenizer
2
3model_name = "xavierwoon/cesterqwen"
4model = AutoModelForCausalLM.from_pretrained(model_name)
5tokenizer = Qwen2Tokenizer.from_pretrained(model_name)
6
7# Paste your own code inside
8code = """
9void add()
10{
11 int a,b,c;
12 printf("\nEnter The Two values:");
13 scanf("%d%d",&a,&b);
14 c=a+b;
15 printf("Addition:%d",c);
16}
17"""
18
19prompt = f"""### Instruction:
20create cester test cases for this function:
21{code}
22
23### Input:
24
25### Response:
26"""
27
28inputs = tokenizer(prompt, return_tensors="pt").to("cpu")
29
30from transformers import TextStreamer
31text_streamer = TextStreamer(tokenizer)
32_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 2048)
Training Data was created based on Data Structures and Algorithm (DSA) codes created using ChatGPT. It would also create corresponding Cester test cases. After testing and ensuring a good code coverage, the prompt and corresponding test cases were added to the dataset.