--- pretty_name: Lapras Reasoning Datasets license: other language: - en task_categories: - question-answering - text-generation tags: - time-series - reasoning - chain-of-thought - latent-reasoning - ecg - sleep-staging - human-activity-recognition size_categories: - 100K`. The five tasks cover cardiological diagnosis (ECG), sleep-stage classification (Sleep), human activity recognition (HAR), counterfactual consequence prediction (TSR) and aero-engine fault diagnosis (Engine). Every task ships in two prompt variants with identical rows: a plain prompt, and a `*_with_ts_tags` prompt with one ` (length L): ` placeholder line per channel. - **Curated by:** the Lapras authors (Yuliang Chen et al., see [Citation](#citation)) - **Language(s) (NLP):** English - **License:** per subset (see [Data Sources](#data-sources)) ### Links - **Repository:** https://github.com/yuc0805/Lapras - **Paper:** https://arxiv.org/abs/2610.11111 - **Checkpoints:** https://huggingface.co/leochen085/Lapras ## Uses ### Direct Use - Supervised finetuning and evaluation of time series language models, with or without reasoning traces. - Reproducing the Lapras experiments: download into the `dataset/` folder of the code repository. ```bash huggingface-cli download leochen085/Lapras-Reasoning-Datasets --repo-type dataset --include "*.jsonl" --local-dir dataset ``` ### Quick start ```python from datasets import load_dataset ds = load_dataset("leochen085/Lapras-Reasoning-Datasets", "har") print(ds) ``` ``` DatasetDict({ train: Dataset({ features: ['input', 'timeseries', 'output'], num_rows: 68542 }) test: Dataset({ features: ['input', 'timeseries', 'output'], num_rows: 8222 }) }) ``` Each row is a dict with `input` (str), `timeseries` (list of channels, each a list of floats) and `output` (str). ### Processor, collator and DataLoader [`lapras_dataloader.py`](lapras_dataloader.py) holds a standard multimodal processor and collator, as for vision-language models: the processor tokenizes the text and packs the time series into a tensor, and the collator builds training batches in which only the response is supervised. ```python from huggingface_hub import hf_hub_download hf_hub_download("leochen085/Lapras-Reasoning-Datasets", "lapras_dataloader.py", repo_type="dataset", local_dir=".") from torch.utils.data import DataLoader from transformers import AutoTokenizer from lapras_dataloader import TimeSeriesProcessor, TimeSeriesCollator processor = TimeSeriesProcessor(AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")) loader = DataLoader(ds["train"], batch_size=4, shuffle=True, collate_fn=TimeSeriesCollator(processor)) batch = next(iter(loader)) ``` ``` input_ids (4, 514) torch.int64 # length varies by batch attention_mask (4, 514) torch.int64 timeseries (4, 3, 128) torch.float32 # (batch, channels, length), zero-padded timeseries_mask (4, 3, 128) torch.bool # True on real samples labels (4, 514) torch.int64 # -100 on the prompt and padding ``` Series of different lengths (TSR) are zero-padded to the longest in the batch and marked in `timeseries_mask`. ### Decoding back ```python tok = processor.tokenizer ids = batch["input_ids"][0][batch["attention_mask"][0].bool()] tok.decode(ids) # '<|im_start|>user\nYou are given accelerometer data in all three dimensions. ... <|eot|>\nAnswer: sitting<|im_end|>' target = tok.decode(batch["labels"][0][batch["labels"][0] != -100], skip_special_tokens=True) target # the example's `output`, character for character target.rsplit("Answer:", 1)[1].strip() # e.g. 'sitting' n_ch = batch["timeseries_mask"][0].any(-1).sum() batch["timeseries"][0][batch["timeseries_mask"][0]].view(n_ch, -1).tolist() # the example's `timeseries` ``` ## Dataset Structure ``` ecg/ train.jsonl test.jsonl train_with_ts_tags.jsonl test_with_ts_tags.jsonl sleep/ ... har/ ... tsr/ ... engine/ ... ``` | Config | Task | Train | Test | Channels | Length | Answer | |---|---|---:|---:|---:|---:|---| | `ecg` | cardiological diagnosis | 5,800 | 643 | 12 | 1000 | `Yes` / `No` | | `sleep` | sleep-stage classification | 7,413 | 923 | 1 | 1500 | `Wake`, `Non-REM stage 1`, `Non-REM stage 2`, `Non-REM stage 3`, `REM sleep` | | `har` | human activity recognition | 68,542 | 8,222 | 3 | 128 | `biking`, `lying`, `running`, `sitting`, `standing`, `walking`, `walking_down`, `walking_up` | | `tsr` | counterfactual consequence prediction | 22,566 | 4,094 | 1 | 128–1020 | option letter + text (`A`–`D`) | | `engine` | aero-engine fault diagnosis | 2,305 | 193 | 33 | 600 | option letter + text (`A`–`D`) | ### Data Fields - `input` (string): the prompt (question, instructions and, for multiple choice, the options). - `timeseries` (list of list of float): one list per channel. ECG and Sleep series are z-normalized per channel; HAR, TSR and Engine series keep the scale of their source release. - `output` (string): the reference trace. Except for ECG, reasoning steps are delimited by `<|bot|>` and `<|eot|>`; HAR, Sleep and TSR traces also contain segment-selection calls ` [channel, start, end] ` (Sleep: `[start, end]`; inclusive sample indices). ECG traces are a single paragraph. Every trace ends with `Answer: