archit11 commited on
Commit
731bfdc
·
verified ·
1 Parent(s): 59973f8

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +100 -37
README.md CHANGED
@@ -1,37 +1,100 @@
1
- ---
2
- dataset_info:
3
- features:
4
- - name: id
5
- dtype: string
6
- - name: type
7
- dtype: string
8
- - name: granularity
9
- dtype: string
10
- - name: content
11
- dtype: string
12
- - name: metadata
13
- struct:
14
- - name: crate
15
- dtype: string
16
- - name: file
17
- dtype: string
18
- - name: files
19
- list: string
20
- - name: module
21
- dtype: string
22
- - name: num_files
23
- dtype: int64
24
- - name: token_count
25
- dtype: int64
26
- splits:
27
- - name: train
28
- num_bytes: 27548399
29
- num_examples: 1076
30
- download_size: 6407777
31
- dataset_size: 27548399
32
- configs:
33
- - config_name: default
34
- data_files:
35
- - split: train
36
- path: data/train-*
37
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hyperswitch Token-Aware CPT Dataset
2
+
3
+ This dataset contains **1,076 samples** of Rust code from the [Hyperswitch](https://github.com/juspay/hyperswitch) payment router project, optimized for Continued Pre-Training (CPT) with the **Kwaipilot/KAT-Dev** tokenizer.
4
+
5
+ ## Dataset Statistics
6
+
7
+ - **Total Samples**: 1,076
8
+ - **Total Tokens**: 5,687,255
9
+ - **Mean Tokens per Sample**: 5,285
10
+ - **Token Range**: 2,001 - 15,609
11
+
12
+ ### Token Distribution
13
+
14
+ - **< 4k tokens**: 38.1% of samples
15
+ - **4k-10k tokens**: 52.0% of samples
16
+ - **10k+ tokens**: 9.9% of samples
17
+
18
+ ### Granularity Types
19
+
20
+ - **file**: 721 samples (single large files)
21
+ - **module**: 180 samples (multiple files from same module)
22
+ - **combined_files**: 160 samples (small files combined by crate)
23
+ - **crate**: 15 samples (entire small crates)
24
+
25
+ ## Top Crates
26
+
27
+ 1. **router** - 371 samples
28
+ 2. **hyperswitch_connectors** - 336 samples
29
+ 3. **analytics** - 54 samples
30
+ 4. **diesel_models** - 39 samples
31
+ 5. **api_models** - 28 samples
32
+
33
+ ## Sample Structure
34
+
35
+ Each sample contains:
36
+ - `id`: Unique identifier
37
+ - `type`: Sample type (always "clm" for causal language modeling)
38
+ - `granularity`: Level of code organization (file/module/combined_files/crate)
39
+ - `content`: Full code with path metadata in format:
40
+ ```
41
+ <path>
42
+ Repository: hyperswitch
43
+ Crate: [crate_name]
44
+ File: [file_path]
45
+ Tokens: [token_count]
46
+ </path>
47
+
48
+ <file>
49
+ [actual code content]
50
+ </file>
51
+ ```
52
+ - `metadata`: Contains crate, file info, and token count
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from datasets import load_dataset
58
+
59
+ # Load the dataset
60
+ dataset = load_dataset("archit11/hyperswitch-token-aware-cpt")
61
+
62
+ # Access samples
63
+ sample = dataset['train'][0]
64
+ print(f"Tokens: {sample['metadata']['token_count']:,}")
65
+ print(f"Crate: {sample['metadata']['crate']}")
66
+ print(f"Granularity: {sample['granularity']}")
67
+
68
+ # Filter by token count
69
+ medium_samples = dataset['train'].filter(
70
+ lambda x: 4000 <= x['metadata']['token_count'] < 10000
71
+ )
72
+
73
+ # Filter by crate
74
+ router_samples = dataset['train'].filter(
75
+ lambda x: x['metadata']['crate'] == 'router'
76
+ )
77
+ ```
78
+
79
+ ## Training Recommendations
80
+
81
+ - **Context Length**: 16k tokens (max sample is 15,609 tokens)
82
+ - **Tokenizer**: Kwaipilot/KAT-Dev
83
+ - **Suggested Batch Size**: 1-2 samples per batch (due to large context)
84
+ - **Format**: Samples are pre-formatted with `<path>` and `<file>` tags
85
+
86
+ ## Source
87
+
88
+ - **Repository**: https://github.com/juspay/hyperswitch
89
+ - **Language**: Rust
90
+ - **License**: Apache 2.0
91
+
92
+ ## Generation Method
93
+
94
+ Samples were generated using token-aware strategies:
95
+ 1. **Large files** (2k-16k tokens) included as-is
96
+ 2. **Small files** combined within same crate until reaching 2k+ tokens
97
+ 3. **Module clusters** grouped by directory structure
98
+ 4. **Complete crates** for small crates that fit within context
99
+
100
+ All token counts measured using the Kwaipilot/KAT-Dev tokenizer.