kotlarmilos commited on
Commit
190b59d
Β·
verified Β·
1 Parent(s): e7b9f50

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +136 -0
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: Repository learning training dataset
3
+ tags:
4
+ - code-review
5
+ - github-data
6
+ - contrastive-learning
7
+ - fine-tuning
8
+ - semantic-indexing
9
+ - multi-modal
10
+ - jsonl
11
+ - faiss-index
12
+ - tree-sitter
13
+ license: mit
14
+ language:
15
+ - en
16
+ size_categories:
17
+ - 10K<n<100K
18
+ task_categories:
19
+ - text-generation
20
+ - text-classification
21
+ - text-retrieval
22
+ - feature-extraction
23
+ source_datasets:
24
+ - github-repositories
25
+ annotations_creators:
26
+ - machine-generated
27
+ - expert-reviewed
28
+ ---
29
+
30
+ # Repository Learning Training Dataset
31
+
32
+ This dataset contains training data extracted from GitHub repositories for training context-aware code review models. The dataset supports three primary machine learning tasks: contrastive learning, fine-tuning, and semantic indexing.
33
+
34
+ ## Dataset Overview
35
+
36
+ **Purpose**: Enable training of AI models that understand repository-specific code review patterns and provide contextual feedback.
37
+
38
+ **Source**: GitHub repositories with rich pull request history and review comments.
39
+
40
+ ## Dataset Structure
41
+
42
+ ```
43
+ {repository-name}/
44
+ β”œβ”€β”€ contrastive/
45
+ β”‚ β”œβ”€β”€ changed_files_001.json # Files changed together (positive pairs)
46
+ β”‚ β”œβ”€β”€ changed_files_002.json
47
+ β”‚ └── ...
48
+ β”œβ”€β”€ fine_tune/
49
+ β”‚ β”œβ”€β”€ pr_reviews_001.jsonl # Instruction-following format
50
+ β”‚ β”œβ”€β”€ pr_reviews_002.jsonl
51
+ β”‚ └── ...
52
+ β”œβ”€β”€ index/
53
+ β”‚ β”œβ”€β”€ functions.json # AST-extracted function metadata
54
+ └── manifest.json # Processing metadata
55
+ ```
56
+
57
+ ## Data Components
58
+
59
+ ### 1. Contrastive Learning Data (`/contrastive/`)
60
+
61
+ **Format**: JSON files containing file groupings for contrastive learning.
62
+
63
+ **Purpose**: Learn semantic relationships between code files based on change patterns.
64
+
65
+ **Structure**:
66
+ ```json
67
+ {
68
+ "pr_12345": [
69
+ "src/components/Button.tsx",
70
+ "src/styles/button.css",
71
+ "tests/Button.test.tsx"
72
+ ],
73
+ "pr_12346": [
74
+ "src/api/user.py",
75
+ "src/models/user.py",
76
+ "tests/test_user.py"
77
+ ]
78
+ }
79
+ ```
80
+
81
+ **Usage**: Files changed together form positive pairs; files from different PRs form negative pairs for contrastive learning.
82
+
83
+ ### 2. Fine-Tuning Data (`/fine_tune/`)
84
+
85
+ **Format**: JSONL files with instruction-following examples.
86
+
87
+ **Purpose**: Adapt language models to repository-specific review patterns and conventions.
88
+
89
+ **Structure**:
90
+ ```json
91
+ {
92
+ "prompt": "Code diff:\n```diff\n+def calculate_score(user_data):\n+ return sum(user_data.values())\n```\nPrevious comments:\n- alice: Consider input validation\n\nPlease write a code review comment:",
93
+ "completion": "Good addition! I'd suggest adding type hints and handling edge cases where user_data might be empty or contain non-numeric values."
94
+ }
95
+ ```
96
+
97
+ **Features**:
98
+ - Chronological conversation context
99
+ - Multi-turn review discussions
100
+ - Repository-specific terminology and patterns
101
+ - Code diff context with surrounding discussion
102
+
103
+ ### 3. Semantic Index Data (`/index/`)
104
+
105
+ **Format**: JSON metadata with function definitions and embeddings.
106
+
107
+ **Purpose**: Enable fast semantic search across repository functions and documentation.
108
+
109
+ **Structure** (`functions.json`):
110
+ ```json
111
+ [
112
+ {
113
+ "file": "src/utils/parser.py",
114
+ "name": "parse_diff_hunk",
115
+ "start_line": 45,
116
+ "end_line": 67,
117
+ "code": "def parse_diff_hunk(hunk_text: str) -> DiffHunk:\n # Function implementation...",
118
+ }
119
+ ]
120
+ ```
121
+
122
+ **Components**:
123
+ - **AST Extraction**: Tree-sitter parsers for different programming languages
124
+
125
+ ## Data Generation Pipeline
126
+
127
+ ### Data Statistics
128
+
129
+ | Repository | PRs | Review Comments | Functions | Languages |
130
+ |------------|-----|-----------------|-----------|-----------|
131
+ | dotnet/xharness | 100 | 50 | 1500 | C# |
132
+ | dotnet/runtime | N/A | N/A | N/A | C#, c, c++ |
133
+
134
+ ## Usage Examples
135
+
136
+ If you use this dataset, please refer to https://github.com/kotlarmilos/repository-learning