jacobhoffmann's picture
Update README.md
3c251b0 verified
|
raw
history blame
3.45 kB
metadata
license: llama2
language:
  - en
base_model:
  - meta-llama/CodeLlama-13b-hf
pipeline_tag: text-generation
tags:
  - code

Model Card for TestGen-Dart v0.2

This model card provides information about TestGen-Dart v0.2, a fine-tuned version of Meta's Code Llama 13B model, optimized for generating unit tests in Dart for mobile applications. This model was developed as part of a research project on enhancing transformer-based large language models (LLMs) for specific downstream tasks while ensuring cost efficiency and accessibility on standard consumer hardware.


Model Details

Model Description

TestGen-Dart v0.2 is a fine-tuned version of Code Llama 13B, specifically adapted for generating unit test cases for Dart code. This model demonstrates enhanced capabilities in producing syntactically and functionally correct test cases compared to its base model.

  • Developed by: Jacob Hoffmann, Demian Frister (Karlsruhe Institute of Technology - KIT, AIFB-BIS)
  • Funded by: Helmholtz Association's Initiative and Networking Fund on the HAICORE@FZJ partition
  • Shared by: Jacob Hoffmann, Demian Frister
  • Model type: Fine-tuned Code Llama 13B for test generation in Dart
  • Language(s): English
  • License: LLaMA 2 Community License
  • Finetuned from model: Meta's Code Llama 13B

Model Sources


Uses

Direct Use

The model can be used in a zero-shot setting to generate unit tests in Dart. Provide the class code as input, and the model outputs structured unit tests using Dart's test package.

Downstream Use

This model is suitable for integration into developer tools, IDE extensions, or continuous integration pipelines to automate test generation for Dart-based applications.

Out-of-Scope Use

  • Do not use this model for tasks unrelated to Dart test generation.
  • Avoid using this model to improve or train other LLMs not based on LLaMA or its derivatives, per the LLaMA 2 Community License.
  • Misuse for malicious purposes, such as generating incorrect or harmful test cases, is prohibited.

Bias, Risks, and Limitations

Technical Limitations

  • The model's performance is optimized for Dart; it may not work as effectively for other programming languages.
  • Functional correctness of the generated tests is not guaranteed; validation by developers is recommended.

Risks

  • Potential for generating syntactically correct but semantically invalid tests. Users should review outputs carefully.
  • May exhibit biases present in the training data.

How to Get Started with the Model

from transformers import AutoModelForCausalLM, AutoTokenizer

# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("username/testgen-dart-v0.2")
model = AutoModelForCausalLM.from_pretrained("username/testgen-dart-v0.2")

# Prepare input
input_code = """
class Calculator {
  int add(int a, int b) {
    return a + b;
  }
}
"""

prompt = f"Generate unit tests in Dart for the following class:\n{input_code}"

# Generate tests
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))