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
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- sensor-language-action
|
| 5 |
+
- physiological-signals
|
| 6 |
+
- clinical
|
| 7 |
+
- multimodal
|
| 8 |
+
- time-series
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
library_name: pytorch
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
base_model:
|
| 14 |
+
- Qwen/Qwen3.5-2B
|
| 15 |
---
|
| 16 |
+
|
| 17 |
+
# OpenSLA: Open Sensor-Language-Action Models
|
| 18 |
+
|
| 19 |
+
[](https://arxiv.org/abs/TODO)
|
| 20 |
+
[](https://yang-ai-lab.github.io/OpenSLA/)
|
| 21 |
+
[](https://github.com/yang-ai-lab/Sensor-Language-Action-Model)
|
| 22 |
+
[](https://github.com/yang-ai-lab/Sensor-Language-Action-Model/blob/main/LICENSE)
|
| 23 |
+
[](#-installation)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
## 🔥 News
|
| 27 |
+
|
| 28 |
+
- [2026.10.3] Our code is released.
|
| 29 |
+
|
| 30 |
+
## 📖 Introduction
|
| 31 |
+
|
| 32 |
+
OpenSLA takes a multi-channel sensor history together with language context and
|
| 33 |
+
produces a structured action prediction and a sensor-state caption. We release
|
| 34 |
+
two variants:
|
| 35 |
+
|
| 36 |
+
- **OpenSLA-B**: sensor tokens are projected and prepended to the language
|
| 37 |
+
prompt as a flat token prefix.
|
| 38 |
+
- **OpenSLA-H**: builds on B with a hierarchical sensor encoder that compresses
|
| 39 |
+
the signal into local, per-channel, and global memory tokens.
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
## 📖 Table of Contents
|
| 43 |
+
|
| 44 |
+
1. [Installation](#-installation)
|
| 45 |
+
2. [Quick Start](#-quick-start)
|
| 46 |
+
3. [Pretrained Weights](#-pretrained-weights)
|
| 47 |
+
4. [Usage](#-usage)
|
| 48 |
+
5. [Datasets](#-datasets)
|
| 49 |
+
6. [Citation](#-citation)
|
| 50 |
+
|
| 51 |
+
## 💿 Installation
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
git clone https://github.com/yang-ai-lab/Sensor-Language-Action-Model.git
|
| 55 |
+
cd Sensor-Language-Action-Model
|
| 56 |
+
pip install -r requirements.txt
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### Dependencies
|
| 60 |
+
|
| 61 |
+
- Python >= 3.10
|
| 62 |
+
- PyTorch >= 2.5
|
| 63 |
+
- Transformers >= 5.8.1 (for the Qwen3.5 backbone)
|
| 64 |
+
- PEFT >= 0.12
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
## 🚀 Quick Start
|
| 68 |
+
|
| 69 |
+
`demo.ipynb` loads a checkpoint, builds an input batch, and runs prediction.
|
| 70 |
+
The same flow in Python:
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
import torch
|
| 74 |
+
from opensla import OpenSLA, SensorBatch
|
| 75 |
+
|
| 76 |
+
model = OpenSLA.from_checkpoint(
|
| 77 |
+
"pretrained_weights/opensla_h_clinical.pt", domain="clinical",
|
| 78 |
+
dino_checkpoint="pretrained_weights/waveform_encoder.ckpt",
|
| 79 |
+
numeric_config="pretrained_weights/numeric_config.json",
|
| 80 |
+
action_group_types="pretrained_weights/action_group_types.json",
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
batch = torch.load("data/preprocessed_batch.pt", weights_only=True)
|
| 84 |
+
predictions = model.predict(batch["input_text"], SensorBatch(**batch["sensors"]))
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
## 📦 Pretrained Weights
|
| 89 |
+
|
| 90 |
+
| Model | Domain | Files |
|
| 91 |
+
|-------|--------|-------|
|
| 92 |
+
| OpenSLA-H | clinical | `opensla_h_clinical.pt`, `waveform_encoder.ckpt`, `numeric_config.json`, `action_group_types.json` |
|
| 93 |
+
|
| 94 |
+
Download the files from this repository and put them under `pretrained_weights/`
|
| 95 |
+
in the code repository.
|
| 96 |
+
|
| 97 |
+
## 👩💻 Usage
|
| 98 |
+
|
| 99 |
+
### Input Format
|
| 100 |
+
|
| 101 |
+
The model takes preprocessed signals as a `.pt` dictionary with `domain`,
|
| 102 |
+
`input_text` (one text context per sample), and `sensors`. The sensors are:
|
| 103 |
+
|
| 104 |
+
- **Waveform**: `waveform` of shape `[B, M, C, T]`, with `M` one-minute slots,
|
| 105 |
+
`C` physical channels, and `T = 7500` samples per slot (60 s at 125 Hz), plus
|
| 106 |
+
a boolean `waveform_channel_mask` (`[B, M, C]`) marking observed
|
| 107 |
+
channel-minutes and int64 `waveform_modality_ids` (`[B, C]`) indexing
|
| 108 |
+
`opensla.WAVEFORM_MODALITIES[domain]`.
|
| 109 |
+
- **Numeric**: observed events as parallel `[B, E]` tensors (`values`,
|
| 110 |
+
`rel_time_min` in minutes before the decision, `measure_ids`, `source_ids`,
|
| 111 |
+
`event_mask`), plus per-measure summary features (`summary_features`,
|
| 112 |
+
`summary_measure_ids`).
|
| 113 |
+
|
| 114 |
+
### Command line
|
| 115 |
+
|
| 116 |
+
Point `configs/template.json` at your weights and input batch, then:
|
| 117 |
+
|
| 118 |
+
```bash
|
| 119 |
+
opensla --config configs/template.json --dry-run # print the resolved config
|
| 120 |
+
opensla --config configs/template.json # write outputs/predictions.jsonl
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
On Slurm:
|
| 124 |
+
|
| 125 |
+
```bash
|
| 126 |
+
sbatch --account=YOUR_ACCOUNT --partition=YOUR_PARTITION scripts/run_template.sbatch --config configs/template.json
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
## 📊 Datasets
|
| 131 |
+
|
| 132 |
+
The models are trained and evaluated on six datasets from three healthcare
|
| 133 |
+
settings, with an additional MIMIC-IV held out as an external clinical cohort. All of them are
|
| 134 |
+
publicly available and can be accessed through the following links.
|
| 135 |
+
|
| 136 |
+
| Dataset | Domain | Sensors | Source |
|
| 137 |
+
|---------|--------|---------|--------|
|
| 138 |
+
| MC-MED | Clinical | ECG, plethysmography, respiration, arterial pressure; vital signs, labs, ventilator and other charted measurements | [PhysioNet](https://physionet.org/content/mc-med/1.0.0/) |
|
| 139 |
+
| MIMIC-III | Clinical | same as MC-MED | [PhysioNet](https://physionet.org/content/mimiciii/1.4/) |
|
| 140 |
+
| MIMIC-IV | Clinical, external evaluation only | waveform-linked subset | [PhysioNet](https://physionet.org/content/mimiciv/2.0/), [waveforms](https://physionet.org/content/mimic4wdb/0.1.0/) |
|
| 141 |
+
| MOVER | Operating room | ECG, plethysmography, arterial/central venous pressure, capnography, airway pressure, EEG; vital signs, hemodynamics, ventilation gases, labs | [UCI MOVER](https://mover.ics.uci.edu/) |
|
| 142 |
+
| VitalDB | Operating room | same as MOVER | [vitaldb.net](https://vitaldb.net/dataset/), [PhysioNet](https://physionet.org/content/vitaldb/1.0.0/) |
|
| 143 |
+
| MetaboNet | CGM | glucose trace; basal insulin delivery | [metabo-net.org](https://metabo-net.org/) |
|
| 144 |
+
| PEDAP | CGM | glucose trace; basal insulin delivery | [Jaeb Center](https://public.jaeb.org/datasets/diabetes) |
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
## 📝 Citation
|
| 148 |
+
|
| 149 |
+
If you use this code or models in your research, please cite our paper:
|
| 150 |
+
|
| 151 |
+
```bibtex
|
| 152 |
+
@misc{xu2026opensla,
|
| 153 |
+
title = {Sensor-Language-Action Models},
|
| 154 |
+
author = {Xu, Yuekai and Shuai, Zitao and Yang, Yuzhe},
|
| 155 |
+
journal = {arXiv preprint},
|
| 156 |
+
year = {2026}
|
| 157 |
+
}
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
## Acknowledgments
|
| 161 |
+
|
| 162 |
+
The waveform encoder adapts from the sensor encoder from
|
| 163 |
+
[OSF](https://github.com/yang-ai-lab/OSF-Open-Sleep-FM) (MIT License).
|