chempile-code / README.md
MrtinoRG's picture
Overwrite defaults + add visible note
50f1009 verified
metadata
dataset_info:
  - config_name: codeparrot_github-code-chemistry-python-default
    features:
      - name: text
        dtype: string
      - name: repo_name
        dtype: string
      - name: path
        dtype: string
      - name: language
        dtype: string
      - name: license
        dtype: string
      - name: size
        dtype: int32
      - name: keyword
        sequence: string
      - name: text_hash
        dtype: string
    splits:
      - name: train
        num_bytes: 3645895510
        num_examples: 186878
      - name: test
        num_bytes: 208905795
        num_examples: 10383
      - name: val
        num_bytes: 200466630
        num_examples: 10382
    download_size: 1469927226
    dataset_size: 4055267935
  - config_name: starcoder-chemistry-default
    features:
      - name: text
        dtype: string
      - name: repo_path
        dtype: string
      - name: keyword
        sequence: string
      - name: text_hash
        dtype: string
    splits:
      - name: train
        num_bytes: 34245426723
        num_examples: 1853757
      - name: test
        num_bytes: 1869671691
        num_examples: 102987
      - name: val
        num_bytes: 1949124399
        num_examples: 102987
    download_size: 14166968855
    dataset_size: 38064222813
configs:
  - config_name: codeparrot_github-code-chemistry-python-default
    data_files:
      - split: train
        path: codeparrot_github-code-chemistry-python-default/train-*
      - split: test
        path: codeparrot_github-code-chemistry-python-default/test-*
      - split: val
        path: codeparrot_github-code-chemistry-python-default/val-*
  - config_name: starcoder-chemistry-default
    data_files:
      - split: train
        path: starcoder-chemistry-default/train-*
      - split: test
        path: starcoder-chemistry-default/test-*
      - split: val
        path: starcoder-chemistry-default/val-*
license:
  - agpl-3.0
tags:
  - chemistry
  - scientific-code
  - simulation-code
  - computational-chemistry
  - materials-science
annotations_creators:
  - expert-generated
language_creators:
  - expert-generated
language:
  - en
multilinguality:
  - monolingual
size_categories:
  - 1M<n<10M
source_datasets:
  - bigcode/the-stack
  - codeparrot/github-code
task_categories:
  - text-generation
task_ids:
  - language-modeling
pretty_name: ChemPile-Code
dataset_version: 1.0.0
dataset_release_date: '2025-05-18'
dataset_citation: |-
  @article{mirza2025chempile0,
    title   = {ChemPile: A 250GB Diverse and Curated Dataset for Chemical Foundation Models},
    author  = {Adrian Mirza and Nawaf Alampara and Martiño Ríos-García and others},
    year    = {2025},
    journal = {arXiv preprint arXiv:2505.12534}
  }

ChemPile-Code

ChemPile Logo

Dataset License: Apache 2.0 Paper Website

A comprehensive collection of filtered scientific code from chemistry, biology, and materials science

📋 Dataset Summary

ChemPile-Code includes filtered code from popular datasets such as the Stack and GitHub-code. It is designed to provide a rich source of scientific coding from fields such as chemistry, biology, and materials science. The dataset is part of the ChemPile project, and aims to create a comprehensive collection of chemistry code for training language models. The filtering process is keyword-based, focusing on packages and libraries relevant to chemistry, biology, and materials science. Those keywords include simulation packages such as LAMMPS, GROMACS, and OpenMM, as well as libraries like RDKit, ASE, and MDTraj, or plotting programmes like VMD or PyMOL. To avoid duplicates, exact hash matching was used to filter out identical code snippets.

📊 Dataset Statistics

Subset Tokens Documents Description
CodeParrot GitHub-Code Chemistry Python 1.8B 208K Python code from GitHub repositories
StarCoder Chemistry 16.1B 2.06M Python code from the Stack dataset
Total ~17.9B ~2.27M Scientific code snippets

🗂️ Dataset Configurations

The dataset includes different subsets available as Hugging Face configurations:

  • codeparrot_github-code-chemistry-python-default
  • starcoder-chemistry-default

📜 License

All content is released under the AGPL-3.0 license, which allows for:

  • ✅ Free use and distribution
  • ✅ Commercial use
  • ✅ Modification and derivatives
  • ⚠️ Attribution required

However, the dataset combines code under different licenses. The config codeparrot_github-code-chemistry-python-default is designed such that is possible to filter the dataset based on the license. Therefore, this config has code under the next licenses:

  • MIT
  • GPL-3.0
  • BSD-3-Clause
  • GPL-2.0
  • Apache-2.0
  • LGPL-2.1
  • AGPL-2.0
  • AGPL-3.0
  • LGPL-3.0
  • MPL-2.0
  • BSD-2-Clause

📖 Dataset Details

📚 CodeParrot

Source: CodeParrot is a subset of GitHub code, that we specifically filtered for chemistry-related content

Coverage: Python code from the GitHub Code dataset

Extraction Method: Keyword-based filtering focusing on chemistry, biology, and materials science packages and libraries

Fields:

  • text: The code snippet
  • repo_name: The name of the repository where the code snippet was found
  • path: The path to the file within the repository
  • language: The programming language of the code snippet
  • license: The license of the repository
  • size: The size of the code snippet in bytes
  • keyword: A list of keywords that were used to filter the code snippet
  • text_hash: A hash of the code snippet to avoid duplicates

Statistics: 208K code snippets with a total of over 1.8B tokens

⚗️ StarCoder

Source: StarCoder is a subset of the Stack dataset, that we specifically filtered for chemistry-related content

Coverage: Python code from the Stack dataset

Extraction Method: Keyword-based filtering with exact hash matching to avoid duplicates

Fields:

  • text: The code snippet
  • repo_name: The name of the repository where the code snippet was found
  • keyword: A list of keywords that were used to filter the code snippet
  • text_hash: A hash of the code snippet to avoid duplicates

Statistics: 2.06M code snippets with a total of over 16.1B tokens

🚀 Quick Start

from datasets import load_dataset, get_dataset_config_names

# Print available configs for the dataset
configs = get_dataset_config_names("jablonkagroup/chempile-code")
print(f"Available configs: {configs}")
# Available configs: ['codeparrot_github-code-chemistry-python-default', 'starcoder-chemistry-default']

dataset = load_dataset("jablonkagroup/chempile-code", name=configs[0])
# Loading config: codeparrot_github-code-chemistry-python-default

print(dataset)
# DatasetDict({
    # train: Dataset({
        # features: ['text', 'repo_name', 'path', 'language', 'license', 'size', 'keyword', 'text_hash'],
        # num_rows: 186878
    # })
    # test: Dataset({
        # features: ['text', 'repo_name', 'path', 'language', 'license', 'size', 'keyword', 'text_hash'],
        # num_rows: 10383
    # })
    # val: Dataset({
        # features: ['text', 'repo_name', 'path', 'language', 'license', 'size', 'keyword', 'text_hash'],
        # num_rows: 10382
    # })
# })

split_name = list(dataset.keys())[0]
sample = dataset[split_name][0]
print(sample)
# {
#     'text': 'import moogli
except Exception as e:...
#     'repo_name': 'BhallaLab/moose', 
#     'path': 'moose-examples/paper-2015/Fig2_elecModels/Fig2C.py', 
#     'language': 'Python', 
#     'license': 'gpl-3.0', 
#     'size': 14223, 
#     'keyword': ['MOOSE', 'NEURON'], 
#     'text_hash': '5eb6a5a439a675762a02c12cdff996e6a0d98f6ee874773cba2951727562aac5'
# }

🎯 Use Cases

  • 🤖 Code Generation: Training models for scientific code generation and completion
  • 🔬 Scientific Computing: Building systems for computational chemistry and materials science
  • 🔍 Code Search: Advanced scientific code repository search and analysis
  • 📝 Documentation: Automated code documentation and analysis for scientific software
  • 🧠 Domain Adaptation: Adapting models to scientific computing paradigms and libraries

⚠️ Limitations & Considerations

  • Language: Primarily Python code (monolingual dataset)
  • Scope: Focused on scientific computing; may include domain-specific jargon and advanced concepts
  • Quality: Variable quality across sources; some code may be incomplete or contain errors
  • Bias: Reflects biases present in open-source scientific software development
  • License: Mixed licenses from source repositories - check individual license field
  • Duplicates: Hash-based deduplication applied but some semantic duplicates may remain

🛠️ Data Processing Pipeline

  1. Collection: Automated extraction from GitHub-code and Stack datasets
  2. Filtering: Keyword-based filtering for chemistry, biology, and materials science relevance
  3. Deduplication: Exact hash matching to remove identical code snippets
  4. Quality Control: Automated filtering and validation
  5. Standardization: Consistent formatting and metadata extraction
  6. Validation: Train/validation/test splits and quality checks

🏗️ ChemPile Collection

This dataset is part of the ChemPile collection, a comprehensive open dataset containing over 75 billion tokens of curated chemical data for training and evaluating general-purpose models in the chemical sciences.

Collection Overview

  • 📊 Scale: 75+ billion tokens across multiple modalities
  • 🧬 Modalities: Structured representations (SMILES, SELFIES, IUPAC, InChI), scientific text, executable code, and molecular images
  • 🎯 Design: Integrates foundational educational knowledge with specialized scientific literature
  • 🔬 Curation: Extensive expert curation and validation
  • 📈 Benchmarking: Standardized train/validation/test splits for robust evaluation
  • 🌐 Availability: Openly released via Hugging Face

📄 Citation

If you use this dataset in your research, please cite:

@article{mirza2025chempile0,
  title   = {ChemPile: A 250GB Diverse and Curated Dataset for Chemical Foundation Models},
  author  = {Adrian Mirza and Nawaf Alampara and Martiño Ríos-García and others},
  year    = {2025},
  journal = {arXiv preprint arXiv:2505.12534}
}

👥 Contact & Support


LamaLab logo

Advancing the evaluation of AI systems in chemistry and materials science