π§ͺ 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
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support
Model tree for Utkarsh524/codellama_utests_full
Base model
codellama/CodeLlama-7b-hf