How facebookresearch/fairchem works
Project type and purpose
• This is a large monorepo for an open-source framework (“fairchem”) providing:
• A core library (src/fairchem/core) with calculation engines, datasets, models, training/evaluation runners, and CLI.
• Multiple applications (src/fairchem/applications/AdsorbML, …/cattsunami, …/ocx) that build on the core to solve domain-specific tasks.
• Data modules (src/fairchem/data/oc, …/odac, …/om) that provide standardized datasets and utilities for materials and molecular data.
• A demo CLI/service (src/fairchem/demo/ocpapi) showcasing client workflows against the FAIRChem core.
• Configuration templates (configs/uma/...) and documentation (docs/…).
• The README clarifies that “fairchem” is a centralized repository of data, pre-trained models, demos, and application code for materials science and quantum chemistry.
File structure and architectural patterns
• Top-level directories:
• src/fairchem/core: core components, pluggable calculation/train/eval pipelines, dataset definitions, model implementations.
• src/fairchem/applications: domain-specific high-level APIs and workflows.
• src/fairchem/data: raw and processed data modules.
• src/fairchem/demo: end-user CLI/service example.
• configs: YAML configs for benchmarking, evaluation, training.
• packages: packaging stubs for PyPI distribution of each sub-module.
• docs: Sphinx/Quarto docs for users and tutorials.
• tests: unit/integration tests for each component.
• Architectural choices:
• Plugin/registry pattern in core (registry.py) for dynamic component loading.
• Configuration-driven workflows (Hydra-style YAML configs).
• Modular packages to publish core, data, applications separately.
• CI/CD pipelines in .github/workflows for build/test/deploy of docs and packages.
README for stack and dependencies
• Python 3.10+
• External libraries: ASE, Hugging Face for model hosting, PyTorch/ML frameworks under the hood.
• CLI (main.py) exposes entrypoints for core functionality.
• Models are fetched from HF and wrapped in an ASE calculator.