Metadata-Version: 2.4
Name: scipkit
Version: 0.2.0
Summary: Scientific perception for language models: unified evaluation, projector loading, and training.
License-Expression: Apache-2.0
Project-URL: Homepage, https://internlm.github.io/Sage-SciPerception/
Project-URL: Repository, https://github.com/InternLM/Sage-SciPerception
Project-URL: Issues, https://github.com/InternLM/Sage-SciPerception/issues
Project-URL: Weights, https://huggingface.co/internlm/Sage-SciPerception
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: huggingface_hub>=0.25
Requires-Dist: numpy>=2.0
Requires-Dist: safetensors>=0.4
Provides-Extra: infer
Requires-Dist: torch>=2.2; extra == "infer"
Requires-Dist: transformers>=4.45; extra == "infer"
Provides-Extra: bio
Requires-Dist: scipy>=1.13; extra == "bio"
Provides-Extra: chem
Requires-Dist: rdkit; extra == "chem"
Requires-Dist: myopic-mces; extra == "chem"
Requires-Dist: pulp; extra == "chem"
Provides-Extra: all
Requires-Dist: torch>=2.2; extra == "all"
Requires-Dist: transformers>=4.45; extra == "all"
Requires-Dist: scipy>=1.13; extra == "all"
Requires-Dist: rdkit; extra == "all"
Requires-Dist: myopic-mces; extra == "all"
Requires-Dist: pulp; extra == "all"
Dynamic: license-file

<h1 align="center">Sage-SciPerception</h1>
<p align="center"><strong>Scientific perception for language models · 书生·元征</strong></p>
<p align="center">Standardize how crystals, spectra, biological sequences, and biosignals connect to language models through modular projectors, unified data contracts, and reproducible evaluation.</p>

<p align="center">
  <a href="https://pypi.org/project/scipkit/"><img src="https://img.shields.io/pypi/v/scipkit?style=flat&amp;labelColor=4B5563&amp;color=00866F" alt="PyPI scipkit"></a>
  <a href="https://internlm.github.io/Sage-SciPerception/modalities/"><img src="https://img.shields.io/badge/Modalities-8%20(9%20tasks)-00866F?style=flat&amp;labelColor=4B5563" alt="8 Modalities"></a>
  <a href="https://internlm.github.io/Sage-SciPerception/"><img src="https://img.shields.io/badge/Docs-Website-00866F?style=flat&amp;labelColor=4B5563" alt="Documentation"></a>
  <a href="https://huggingface.co/internlm/Sage-SciPerception"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Weights-00866F?style=flat&amp;labelColor=4B5563" alt="Hugging Face Weights"></a>
  <a href="https://huggingface.co/datasets/internlm/Sage-SciPerception-Training"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Training_Samples-00866F?style=flat&amp;labelColor=4B5563" alt="Training Samples"></a>
  <a href="https://github.com/InternLM/Sage-SciPerception/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/InternLM/Sage-SciPerception/ci.yml?branch=main&amp;style=flat&amp;labelColor=4B5563&amp;label=CI" alt="CI status"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-6B7280?style=flat&amp;labelColor=4B5563" alt="Apache 2.0 License"></a>
  <a href="pyproject.toml"><img src="https://img.shields.io/badge/Python-3.12%2B-6B7280?style=flat&amp;logo=python&amp;logoColor=FFD43B&amp;labelColor=4B5563" alt="Python 3.12+"></a>
</p>

<p align="center">
  <a href="https://internlm.github.io/Sage-SciPerception/modalities/">Modalities</a> ·
  <a href="https://internlm.github.io/Sage-SciPerception/">Docs</a> ·
  <a href="#quick-start">Quick start</a> ·
  <a href="#results">Results</a> ·
  <a href="CONTRIBUTING.md">Contributing</a> ·
  <a href="https://github.com/InternLM/Sage-SciPerception/issues">Roadmap &amp; Issues</a> ·
  <a href="README_zh.md">简体中文</a>
</p>

<p align="center">
  <img src="assets/branding/sage-sciprojector-hero-titled.png" alt="A young scholar explores molecular, genomic, crystal and spectral representations in a scientific garden." width="640">
</p>

Sage-SciPerception standardizes the four orthogonal seams between scientific representations and language models:

| Seam | Interface | What it standardizes |
| --- | --- | --- |
| **1. Encoder** | `sage-training-data-v1` / `FeatureCache` | Variable-length states (`nodes`, `offsets`), discrete atom/spectrum columns (`modality.npy`), and scientific readouts (`side.npy`) |
| **2. Projector** | `sage-projector-v1` (`modeling_projector.py`) | Standalone `.safetensors` + `config.json` checkpoints portable across training and serving |
| **3. Backbone** | `ProjectorSession` / `prompt_embeds` | Non-invasive scientific embedding injection for vLLM `/v1/completions` and XTuner SFT |
| **4. Task / Verifier** | `EvalKit` (`EvalDataset`, `scip eval`) | Versioned holdout protocols, resumable `run_id` logs, and deterministic CPU scoring / RL rewards |

## News

- **2026-12 (`v0.2.0`)**: Published **`scipkit`** (`pip install scipkit`, unified `scip` CLI), generalized **`ProjectorSession`** for non-GLM backbones, unified 9-modality client [`examples/vllm_projector.py`](examples/vllm_projector.py), and the [Modalities showcase](https://internlm.github.io/Sage-SciPerception/modalities/).
- **2026-11**: Published all 9 `EvalKit` benchmark datasets, `TrainKit` recipes, and 2-row training slices on [Hugging Face Datasets](https://huggingface.co/datasets/internlm/Sage-SciPerception-Training).

## Examples

<table width="100%">
  <tr>
    <td width="50%" align="center">
      <img src="assets/spectra-en.gif" alt="Joint spectra, streamed analysis, and a predicted molecule." width="100%"><br>
      <b>Three spectra → molecular structure</b><br>
      <sub>IR, Raman and UV–Vis with streamed analysis and a recorded prediction.</sub>
    </td>
    <td width="50%" align="center">
      <img src="assets/protein-en.gif" alt="Protein sequence positions and reference interface annotations." width="100%"><br>
      <b>Protein interface sites</b><br>
      <sub>Sequence positions and reference residue-level annotations.</sub>
    </td>
  </tr>
  <tr>
    <td width="50%" align="center">
      <img src="assets/crystal-en.gif" alt="Crystal geometry and its reference formation energy." width="100%"><br>
      <b>Crystal structure and formation energy</b><br>
      <sub>Atomic geometry and a reference material property.</sub>
    </td>
    <td width="50%" align="center">
      <img src="assets/rna-iterations-en.gif" alt="Recorded RNA interface experiments and evaluation feedback." width="100%"><br>
      <b>RNA interface refinement</b><br>
      <sub>Design revisions guided by experimental feedback.</sub>
    </td>
  </tr>
</table>

## Quick start

Install `scipkit` (`pip install scipkit` or `pip install -e ".[infer]"` from source), check your environment, and verify a released projector on CPU:

```bash
pip install "scipkit[infer]"   # or CPU-only scoring/inspection: pip install scipkit

scip doctor
scip list
scip download glm-5.3-flash/cif/jarvis --local-dir ./checkpoints
```

```python
from load_projector import load_projector

projector, config = load_projector(
    "checkpoints/projectors/glm-5.3-flash/cif/jarvis", device="cpu"
)
print(config["task"], sum(p.numel() for p in projector.parameters()), config["output_dim"])
# cif/jarvis 4314304 4096
```

## Documentation & guides

| Topic | Documentation | Repository entry points |
|---|---|---|
| Modalities | [Supported modalities](https://internlm.github.io/Sage-SciPerception/modalities/) | Overview, common datasets, and demos across 8 modalities |
| Quick start | [Get started](https://internlm.github.io/Sage-SciPerception/docs/start/) | [`load_projector.py`](load_projector.py), [`modeling_projector.py`](modeling_projector.py) |
| Inference with vLLM | [Inference guide](https://internlm.github.io/Sage-SciPerception/docs/guides/inference/) | [`examples/README.md`](examples/README.md), [`examples/vllm_projector.py`](examples/vllm_projector.py), [`examples/vllm_cif.py`](examples/vllm_cif.py) |
| Training a projector | [Training guide](https://internlm.github.io/Sage-SciPerception/docs/guides/training/) | [`trainkit/README.md`](trainkit/README.md) · [Training samples](https://huggingface.co/datasets/internlm/Sage-SciPerception-Training) |
| Evaluation | [Evaluation guide](https://internlm.github.io/Sage-SciPerception/docs/guides/evaluation/) | [`evalkit/`](evalkit/), [`examples/neu06/README.md`](examples/neu06/README.md) |
| Tutorial book | [Tutorial](https://internlm.github.io/Sage-SciPerception/book/) | End-to-end chapters including [all inference examples](https://internlm.github.io/Sage-SciPerception/book/06-inference-examples/) |

## Results

Scores from generated answers using selected task-specific checkpoints. Each task page documents its encoder, expected `scientific_inputs`, and training step.

| Benchmark / task | Metric ↑ | Score | Checkpoint | Evaluation |
|---|---|---:|---|---|
| [JARVIS-DFT](https://internlm.github.io/Sage-SciPerception/docs/tasks/cif-jarvis/)<br>Formation energy | MAD/MAE | **15.03** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/cif/jarvis) | [`llm4mat-jarvis`](evalkit/README.md#registered-datasets) |
| [MPBind](https://internlm.github.io/Sage-SciPerception/docs/tasks/protein-seq-mpbind/)<br>PPI interface sites | Per-protein F1 (%) | **61.12** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/protein-seq/mpbind) | [`mpbind-ba1`](evalkit/README.md#registered-datasets) |
| [QM9S](https://internlm.github.io/Sage-SciPerception/docs/tasks/spectra-qm9s/)<br>Molecular structure identification | Acc@1 (%) | **49.75** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/spectra/qm9s) | [`qm9s-allspectra`](evalkit/README.md#registered-datasets) |
| [SciTS PHU01](https://internlm.github.io/Sage-SciPerception/docs/tasks/ecg-phu01/)<br>ECG classification | Macro-F1 (%) | **71.53** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/ecg/phu01) | [`scits-phu01`](evalkit/README.md#registered-datasets) |
| [GUE splice](https://internlm.github.io/Sage-SciPerception/docs/tasks/dna-splice/)<br>Splice-site classification | MCC (%) | **87.87** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/dna/splice) | [`gue-splice`](evalkit/README.md#registered-datasets) |
| [SciTS NEU06](https://internlm.github.io/Sage-SciPerception/docs/tasks/eeg-neu06/)<br>Sleep staging | Macro-F1 (%) | **72.01** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/eeg/neu06) | [`scits-neu06`](evalkit/README.md#registered-datasets) · [NEU06 guide](examples/neu06/README.md) |
| [BEACON ncRNA](https://internlm.github.io/Sage-SciPerception/docs/tasks/rna-ncrna/)<br>RNA family classification | Accuracy (%) | **97.35** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/rna/ncrna) | [`beacon-ncrna`](evalkit/README.md#registered-datasets) |
| [SimXRD OL](https://internlm.github.io/Sage-SciPerception/docs/tasks/xrd-simxrd/)<br>Crystal-system classification | Accuracy (%) | **63.60** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/xrd/simxrd) | [`simxrd-ol`](evalkit/README.md#registered-datasets) |
| [ATOM3D PSR](https://internlm.github.io/Sage-SciPerception/docs/tasks/protein-struct-psr/)<br>Protein structure ranking | Spearman (%) | **35.36** | [Files](https://huggingface.co/internlm/Sage-SciPerception/tree/main/projectors/glm-5.3-flash/protein-struct/psr) | [`atom3d-psr`](evalkit/README.md#registered-datasets) |

Metrics differ across rows: **MAD/MAE is a ratio where higher is better.** MPBind uses the assembly-1 reconstructed evaluation set and mean per-protein F1; PSR uses mean Spearman. These scores do not describe a jointly trained model.

## Contributing & Roadmap

We are actively building out support for additional language backbones (Qwen, InternLM, Llama), open-source end-to-end scientific encoders, and new frontier modalities (molecules, NMR, mass spectrometry, single-cell, microscopy, astronomy, weather & climate).

- Read [`CONTRIBUTING.md`](CONTRIBUTING.md) and [`tests/test_contributor_fixtures.py`](tests/test_contributor_fixtures.py) to add a dataset, encoder, or backbone in a few lines.
- Pick up a [`good first issue`](https://github.com/InternLM/Sage-SciPerception/issues?q=is%3Aopen+label%3A%22good+first+issue%22) or comment on our [open issues](https://github.com/InternLM/Sage-SciPerception/issues) to claim a task.

## Contributors

<table>
  <tr>
    <td align="center">
      <a href="https://github.com/yuhangzang"><img src="https://github.com/yuhangzang.png?size=128" width="64" height="64" alt="yuhangzang"><br><sub><b>yuhangzang</b></sub></a>
    </td>
  </tr>
</table>

## License

This repository is released under the [Apache License 2.0](LICENSE). Upstream datasets, base language models, and scientific encoders remain governed by their respective licenses.

## Citation

If you use Sage-SciPerception (`scipkit`) in your work, please cite:

```bibtex
@misc{sage_sciperception,
  author       = {{InternLM}},
  title        = {{Sage-SciPerception}},
  version      = {0.2.0},
  note         = {GitHub repository},
  year         = {2026},
  url          = {https://github.com/InternLM/Sage-SciPerception}
}
```
