code-review-agent / README.md
100XZX001's picture
Update README.md
e6e4c9f verified
---
language: en
license: mit
tags:
- code-review
- agent
- text-generation
- distilgpt2
widget:
- text: "Review this code:\ndef get_user(id):\n return users[id]"
example_title: "Missing null check"
- text: "Improve this loop:\nfor i in range(len(items)):\n process(items[i])"
example_title: "Inefficient loop"
- text: "Fix this average calculation:\ndef avg(data):\n return sum(data)/len(data)"
example_title: "Division by zero"
---
# Code Review Agent Model
This is a lightweight language model (based on `distilgpt2`) designed to generate helpful code review comments. It is a starting point for building an AI that reviews pull requests, suggests improvements, and catches common bugs.
## Model Details
- **Base model**: [distilgpt2](https://huggingface.co/distilgpt2) – a distilled version of GPT-2 with 82M parameters.
- **Language**: English
- **Intended use**: Generating code review comments, suggesting fixes, and answering questions about code.
- **Limitations**: The model has not been fine‑tuned on code‑review data; it may produce generic or off‑topic responses. Fine‑tuning on a dataset of real code reviews would greatly improve its utility.
## How to Use
### With transformers pipeline
```python
from transformers import pipeline
pipe = pipeline("text-generation", model="your-username/code-review-agent")
code = "def get_user(id):\n return users[id] # missing null check"
prompt = f"Review this code:\n{code}\nComment:"
result = pipe(prompt, max_new_tokens=100, do_sample=True, temperature=0.7)
print(result[0]['generated_text'])