100XZX001 commited on
Commit
e6e4c9f
·
verified ·
1 Parent(s): a21f6ae

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -1
README.md CHANGED
@@ -4,4 +4,38 @@ license: mit
4
  tags:
5
  - code-review
6
  - agent
7
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  tags:
5
  - code-review
6
  - agent
7
+ - text-generation
8
+ - distilgpt2
9
+ widget:
10
+ - text: "Review this code:\ndef get_user(id):\n return users[id]"
11
+ example_title: "Missing null check"
12
+ - text: "Improve this loop:\nfor i in range(len(items)):\n process(items[i])"
13
+ example_title: "Inefficient loop"
14
+ - text: "Fix this average calculation:\ndef avg(data):\n return sum(data)/len(data)"
15
+ example_title: "Division by zero"
16
+ ---
17
+
18
+ # Code Review Agent Model
19
+
20
+ 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.
21
+
22
+ ## Model Details
23
+
24
+ - **Base model**: [distilgpt2](https://huggingface.co/distilgpt2) – a distilled version of GPT-2 with 82M parameters.
25
+ - **Language**: English
26
+ - **Intended use**: Generating code review comments, suggesting fixes, and answering questions about code.
27
+ - **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.
28
+
29
+ ## How to Use
30
+
31
+ ### With transformers pipeline
32
+
33
+ ```python
34
+ from transformers import pipeline
35
+
36
+ pipe = pipeline("text-generation", model="your-username/code-review-agent")
37
+
38
+ code = "def get_user(id):\n return users[id] # missing null check"
39
+ prompt = f"Review this code:\n{code}\nComment:"
40
+ result = pipe(prompt, max_new_tokens=100, do_sample=True, temperature=0.7)
41
+ print(result[0]['generated_text'])