Instructions to use ParadiseYu/TS-Reasoner-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ParadiseYu/TS-Reasoner-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ParadiseYu/TS-Reasoner-7B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("ParadiseYu/TS-Reasoner-7B", trust_remote_code=True) model = AutoModel.from_pretrained("ParadiseYu/TS-Reasoner-7B", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ParadiseYu/TS-Reasoner-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ParadiseYu/TS-Reasoner-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ParadiseYu/TS-Reasoner-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ParadiseYu/TS-Reasoner-7B
- SGLang
How to use ParadiseYu/TS-Reasoner-7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ParadiseYu/TS-Reasoner-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ParadiseYu/TS-Reasoner-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ParadiseYu/TS-Reasoner-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ParadiseYu/TS-Reasoner-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ParadiseYu/TS-Reasoner-7B with Docker Model Runner:
docker model run hf.co/ParadiseYu/TS-Reasoner-7B
TS-Reasoner-7B
TS-Reasoner couples a frozen Time Series Foundation Model (TimesFM) with a Qwen2.5-7B LLM so the language model can reason over raw numerical time series. The TSFM's latent representations are aligned with the LLM's textual input space through a two-stage recipe: alignment pretraining on synthetic time series–caption pairs, followed by instruction finetuning.
📄 Paper: TS-Reasoner: Aligning Time Series Foundation Models with LLM Reasoning | 💻 Code: Yu-Fangxu/TS-Reasoner
Usage
Loading is self-contained — the model code automatically downloads and attaches the frozen TimesFM backbone (google/timesfm-1.0-200m-pytorch) on first use:
import numpy as np
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("ParadiseYu/TS-Reasoner-7B", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"ParadiseYu/TS-Reasoner-7B", trust_remote_code=True, torch_dtype=torch.float16
).to("cuda").eval()
Prompts contain one <ts><ts/> placeholder per series (preceded by a value-scaling prefix); the raw series are passed to generate via the timeseries= kwarg as a (num_series, length, 2) fp16 tensor of [scaled_value, mask] pairs. See demo.py in the code repository for a complete helper (load_ts_reasoner / ask) that handles the scaling, prompt assembly, and padding:
# git clone https://github.com/Yu-Fangxu/TS-Reasoner && cd TS-Reasoner
from demo import load_ts_reasoner, ask
tokenizer, model = load_ts_reasoner()
answer = ask(
tokenizer, model,
question="Time series 1: <ts><ts/>\nWhat is the overall trend?",
timeseries=[[0.1, 0.3, 0.2, 0.5, 0.8, 1.2, 1.1, 1.6]],
)
print(answer)
Citation
@article{yu2025tsreasoner,
title={TS-Reasoner: Aligning Time Series Foundation Models with LLM Reasoning},
author={Yu, Fangxu and Zhao, Hongyu and Zhou, Tianyi},
journal={arXiv preprint arXiv:2510.03519},
year={2025}
}
- Downloads last month
- 996