naresns2004 sahancpal commited on
Commit
6c56990
·
0 Parent(s):

Duplicate from GPUMODE/KernelBook

Browse files

Co-authored-by: Sahan Paliskara <sahancpal@users.noreply.huggingface.co>

Files changed (5) hide show
  1. .gitattributes +60 -0
  2. LICENSE +21 -0
  3. README.md +96 -0
  4. dataset_permissive.json +3 -0
  5. dataset_permissive.parquet +3 -0
.gitattributes ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mds filter=lfs diff=lfs merge=lfs -text
13
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
+ *.model filter=lfs diff=lfs merge=lfs -text
15
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
16
+ *.npy filter=lfs diff=lfs merge=lfs -text
17
+ *.npz filter=lfs diff=lfs merge=lfs -text
18
+ *.onnx filter=lfs diff=lfs merge=lfs -text
19
+ *.ot filter=lfs diff=lfs merge=lfs -text
20
+ *.parquet filter=lfs diff=lfs merge=lfs -text
21
+ *.pb filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.tflite filter=lfs diff=lfs merge=lfs -text
32
+ *.tgz filter=lfs diff=lfs merge=lfs -text
33
+ *.wasm filter=lfs diff=lfs merge=lfs -text
34
+ *.xz filter=lfs diff=lfs merge=lfs -text
35
+ *.zip filter=lfs diff=lfs merge=lfs -text
36
+ *.zst filter=lfs diff=lfs merge=lfs -text
37
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
38
+ # Audio files - uncompressed
39
+ *.pcm filter=lfs diff=lfs merge=lfs -text
40
+ *.sam filter=lfs diff=lfs merge=lfs -text
41
+ *.raw filter=lfs diff=lfs merge=lfs -text
42
+ # Audio files - compressed
43
+ *.aac filter=lfs diff=lfs merge=lfs -text
44
+ *.flac filter=lfs diff=lfs merge=lfs -text
45
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
46
+ *.ogg filter=lfs diff=lfs merge=lfs -text
47
+ *.wav filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - uncompressed
49
+ *.bmp filter=lfs diff=lfs merge=lfs -text
50
+ *.gif filter=lfs diff=lfs merge=lfs -text
51
+ *.png filter=lfs diff=lfs merge=lfs -text
52
+ *.tiff filter=lfs diff=lfs merge=lfs -text
53
+ # Image files - compressed
54
+ *.jpg filter=lfs diff=lfs merge=lfs -text
55
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
56
+ *.webp filter=lfs diff=lfs merge=lfs -text
57
+ # Video files - compressed
58
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
59
+ *.webm filter=lfs diff=lfs merge=lfs -text
60
+ dataset_permissive.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) Meta Platforms, Inc. and affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ ---
6
+ ## Overview
7
+
8
+ `dataset_permissive{.json/.parquet}` is a curated collection of pairs of pytorch programs and equivalent triton code (generated by torch inductor) which can be used to train models to translate pytorch code to triton code.
9
+ The triton code was generated using **PyTorch 2.5.0** so for best results during evaluation / running the triton code we recommend using that version of pytorch.
10
+
11
+ ## Dataset Creation
12
+
13
+ The dataset was created through the following process:
14
+
15
+ 1. **Repository Collection**: PyTorch repositories were collected from GitHub using repositories (and associated hashes) from the [Stack v1](https://huggingface.co/datasets/bigcode/the-stack).
16
+ 2. **PyTorch Module Extraction**: We extracted the pytorch code from the repositories, and seperated them into individual `torch.nn` modules with appropriate dependencies.
17
+ 3. **Creating Unit Tests**: We created unit tests for each module to ensure that the code was working as expected. Code in which could not create unit tests for was removed.
18
+ 4. **Extracting Triton Code**: We used torch.compile in order to produce triton code from the pytorch code.
19
+ 5. **Transorming Triton Code**: We transformed the triton code into one which resembled the format seen in [KernelBench](https://github.com/ScalingIntelligence/KernelBench).
20
+ 5. **Metadata Enrichment**: Each repository entry was enriched with metadata such as license information, star count, and commit SHA.
21
+
22
+ The scripts to do this yourself can be found [here](https://github.com/pytorch-labs/popcorn-kernels/tree/main/github_pytorch_index)
23
+
24
+ ## Data Structure
25
+
26
+ Each entry in the dataset contains the following fields:
27
+
28
+ | Field | Description |
29
+ |-------|-------------|
30
+ | `repo_name` | The name of the repository in the format `username/repository` |
31
+ | `licenses` | List of licenses associated with the repository |
32
+ | `stars` | Number of GitHub stars the repository has |
33
+ | `sha` | The commit SHA hash used for version reference |
34
+ | `repo_link` | Direct link to the repository at the specific commit (GitHub URL) |
35
+ | *Additional fields* | The dataset may contain other repository-specific information |
36
+
37
+ ## File Formats
38
+
39
+ The dataset is available in two formats:
40
+
41
+ 1. **JSON**: `dataset_permissive.json` - A human-readable format that can be easily parsed by most programming languages.
42
+ 2. **Parquet**: `dataset_permissive.parquet` - A columnar storage format optimized for analytics and big data processing.
43
+
44
+ ## Usage Examples
45
+
46
+ ### Loading the Dataset in Python
47
+
48
+ #### Using JSON:
49
+ ```python
50
+ import json
51
+
52
+ # Load the JSON version
53
+ with open('dataset_permissive.json', 'r') as f:
54
+ repos = json.load(f)
55
+
56
+ # Example: Print the first 5 repository names
57
+ for repo in repos[:5]:
58
+ print(repo['repo_name'])
59
+ ```
60
+
61
+ #### Using Parquet:
62
+ ```python
63
+ import pandas as pd
64
+
65
+ # Load the Parquet version
66
+ df = pd.read_parquet('dataset_permissive.parquet')
67
+
68
+ # Example: Get repositories with more than 1000 stars
69
+ popular_repos = df[df['stars'] > 1000]
70
+ print(f"Number of popular repositories: {len(popular_repos)}")
71
+ ```
72
+
73
+ ## License Information
74
+
75
+ The `dataset_permissive` contains only repositories with permissive licenses, including but not limited to:
76
+
77
+ - MIT License
78
+ - Apache License 2.0
79
+ - BSD Licenses (various)
80
+ - Mozilla Public License
81
+ - Unlicense
82
+ - zlib License
83
+
84
+ The dataset itself is provided for research and development purposes. Users should still verify the license of individual repositories before using their code in production or commercial settings.
85
+
86
+ ## Citation
87
+
88
+ ```
89
+ @software{kernelbook2025,
90
+ title={KernelBook},
91
+ author={Paliskara, Sahan and Saroufim, Mark},
92
+ year={2025},
93
+ month={5},
94
+ url={https://huggingface.co/datasets/GPUMODE/KernelBook},
95
+ }
96
+ ```
dataset_permissive.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:929fb544e83064b786a05a3e9851ebc72271c191fb8bff29d0c2cf5cff5e4bf3
3
+ size 416411313
dataset_permissive.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64af2baa3c9a835dac85a5d0c772cc698610bccd5c63c44a56ebe0afaf5d9ed2
3
+ size 87425771