Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,37 +1,100 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 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.
|