|
--- |
|
license: mit |
|
language: |
|
- en |
|
--- |
|
## Overview |
|
|
|
`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. |
|
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. |
|
|
|
## Dataset Creation |
|
|
|
The dataset was created through the following process: |
|
|
|
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). |
|
2. **PyTorch Module Extraction**: We extracted the pytorch code from the repositories, and seperated them into individual `torch.nn` modules with appropriate dependencies. |
|
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. |
|
4. **Extracting Triton Code**: We used torch.compile in order to produce triton code from the pytorch code. |
|
5. **Transorming Triton Code**: We transformed the triton code into one which resembled the format seen in [KernelBench](https://github.com/ScalingIntelligence/KernelBench). |
|
5. **Metadata Enrichment**: Each repository entry was enriched with metadata such as license information, star count, and commit SHA. |
|
|
|
## Data Structure |
|
|
|
Each entry in the dataset contains the following fields: |
|
|
|
| Field | Description | |
|
|-------|-------------| |
|
| `repo_name` | The name of the repository in the format `username/repository` | |
|
| `licenses` | List of licenses associated with the repository | |
|
| `stars` | Number of GitHub stars the repository has | |
|
| `sha` | The commit SHA hash used for version reference | |
|
| `repo_link` | Direct link to the repository at the specific commit (GitHub URL) | |
|
| *Additional fields* | The dataset may contain other repository-specific information | |
|
|
|
## File Formats |
|
|
|
The dataset is available in two formats: |
|
|
|
1. **JSON**: `dataset_permissive.json` - A human-readable format that can be easily parsed by most programming languages. |
|
2. **Parquet**: `dataset_permissive.parquet` - A columnar storage format optimized for analytics and big data processing. |
|
|
|
## Usage Examples |
|
|
|
### Loading the Dataset in Python |
|
|
|
#### Using JSON: |
|
```python |
|
import json |
|
|
|
# Load the JSON version |
|
with open('dataset_permissive.json', 'r') as f: |
|
repos = json.load(f) |
|
|
|
# Example: Print the first 5 repository names |
|
for repo in repos[:5]: |
|
print(repo['repo_name']) |
|
``` |
|
|
|
#### Using Parquet: |
|
```python |
|
import pandas as pd |
|
|
|
# Load the Parquet version |
|
df = pd.read_parquet('dataset_permissive.parquet') |
|
|
|
# Example: Get repositories with more than 1000 stars |
|
popular_repos = df[df['stars'] > 1000] |
|
print(f"Number of popular repositories: {len(popular_repos)}") |
|
``` |
|
|
|
## License Information |
|
|
|
The `dataset_permissive` contains only repositories with permissive licenses, including but not limited to: |
|
|
|
- MIT License |
|
- Apache License 2.0 |
|
- BSD Licenses (various) |
|
- Mozilla Public License |
|
- Unlicense |
|
- zlib License |
|
|
|
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. |