Ubuntu
commited on
Commit
Β·
fdd0e33
0
Parent(s):
Initial commit
Browse files
README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# .NET Runtime Training Data and Index
|
| 2 |
+
|
| 3 |
+
This directory contains data for fine-tuning models and building RAGs for the dotnet/runtime repository.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
- **data/**: Contains all datasets and indexes.
|
| 8 |
+
- **raw_sample/**: Directories of raw PRs and diffs as collected from GitHub.
|
| 9 |
+
- **raw_data.tar**: Collected PRs and diffs from GitHub.
|
| 10 |
+
- **samples/**: JSONL files with processed samples suitable for dataset generation (e.g., HuggingFace).
|
| 11 |
+
- **processed/**: Parquet or JSONL files for fine-tuning (e.g., `train.parquet`, `test.parquet`).
|
| 12 |
+
- **faiss/**: Vector indexes for RAG workflows.
|
| 13 |
+
- **scripts/**: Python and Node.js scripts for crawling, processing, and indexing.
|
| 14 |
+
|
| 15 |
+
## Data Structure
|
| 16 |
+
|
| 17 |
+
```
|
| 18 |
+
data/
|
| 19 |
+
βββ raw_data.tar
|
| 20 |
+
βββ raw_sample/
|
| 21 |
+
β βββ prs/
|
| 22 |
+
β βββ diffs/
|
| 23 |
+
β βββ ... (extracted files)
|
| 24 |
+
βββ processed/
|
| 25 |
+
β βββ train.parquet
|
| 26 |
+
β βββ test.parquet
|
| 27 |
+
βββ faiss/
|
| 28 |
+
βββ index
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
- **raw_data/**: Contains the full, unprocessed PR and diff data as collected from GitHub.
|
| 32 |
+
- **samples/**: Contains JSONL files formatted for use with HuggingFace Datasets.
|
| 33 |
+
- **processed/**: Contains files for model fine-tuning.
|
| 34 |
+
- **faiss/**: Contains vector indexes for fast retrieval in RAG setups.
|
| 35 |
+
|
| 36 |
+
## Generated dataset
|
| 37 |
+
|
| 38 |
+
PR is considered as a timeline with events. Input is PR metadata (title, description, label) and commit n-1, with all events between n-1 and n. Completion is n. It is possible to filter by time, label, authors, etc.
|
| 39 |
+
|
| 40 |
+
## Scripts
|
| 41 |
+
|
| 42 |
+
See [scripts/README.md](scripts/README.md) for details on running the crawler, dataset generation, fine-tuning, and RAG indexing.
|
| 43 |
+
|
| 44 |
+
## PyTorch Dataset Example
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
from datasets import load_dataset
|
| 48 |
+
|
| 49 |
+
# Load Parquet train/test splits
|
| 50 |
+
train = load_dataset("parquet", data_files="data/processed/train.parquet", split="train")
|
| 51 |
+
test = load_dataset("parquet", data_files="data/processed/test.parquet", split="train")
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## RAG Vector Search Example
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
import faiss
|
| 58 |
+
import numpy as np
|
| 59 |
+
|
| 60 |
+
# Load FAISS index
|
| 61 |
+
index = faiss.read_index("data/faiss/index.faiss")
|
| 62 |
+
|
| 63 |
+
# Example query embedding (replace with your embedding)
|
| 64 |
+
query_embedding = ...
|
| 65 |
+
|
| 66 |
+
# Search
|
| 67 |
+
D, I = index.search(query_embedding.reshape(1, -1), k=5)
|
| 68 |
+
print("Top 5 similar PR indices:", I[0])
|
| 69 |
+
```
|