πŸ§ͺ CodeLLaMA Unit Test Generator (Merged Model)

This is a merged model that combines codellama/CodeLlama-7b-hf with LoRA fine-tuning trained on a dataset of embedded C/C++ functions and corresponding unit tests.

It specializes in generating comprehensive unit tests for C/C++ code using frameworks like GoogleTest or CppUTest, focusing on:

  • Edge cases
  • Boundary conditions
  • Exception handling
  • MISRA C compliance (if applicable)

πŸ“Œ Example Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model = AutoModelForCausalLM.from_pretrained("Utkarsh524/codellama_utests_full")
tokenizer = AutoTokenizer.from_pretrained("Utkarsh524/codellama_utests_full")

prompt = "<|system|>\nGenerate comprehensive unit tests for C/C++ code. Cover all edge cases, boundary conditions, and error scenarios.\nOutput Constraints:\n1. ONLY include test code (no explanations, headers, or main functions)\n2. Start directly with TEST(...)\n3. End after last test case\n4. Never include framework boilerplate\n<|user|>\nCreate tests for:\nint add(int a, int b) { return a + b; }\n<|assistant|>\n"

inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Downloads last month
0
Safetensors
Model size
6.74B params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Utkarsh524/codellama_utests_full

Adapter
(536)
this model