DualWeaver: A PyPI package for adapting Hugging Face Time Series Foundation Models with Synergistic Feature Weaving.
Project description
DualWeaver
DualWeaver is an official PyPI package for adapting Hugging Face Time Series Foundation Models (TSFMs) using Synergistic Feature Weaving.
This package allows you to seamlessly integrate the DualWeaver methodology with any open-source pre-trained model based on the transformers library to significantly improve forecasting performance while preserving the original pre-trained knowledge.
Installation
pip install dualweaver
Or install from source:
git clone https://github.com/yourusername/dualweaver.git
cd dualweaver
pip install -e .
Quick Start
import torch
from transformers import AutoConfig, AutoModelForCausalLM
from dualweaver import DualWeaverConfig, DualWeaverModel
# 1. Load an open-source TSFM from Hugging Face
hf_config = AutoConfig.from_pretrained("thuml/timer-base-84m")
hf_model = AutoModelForCausalLM.from_config(hf_config) # or from_pretrained
# 2. Configure DualWeaver
config = DualWeaverConfig(
adapter="WeaverMLP", # or "WeaverCNN"
input_channel=7,
hf_model_type="timer"
)
# 3. Wrap with DualWeaver
model = DualWeaverModel(config, hf_model)
# 4. Train
model.train()
batch_x = torch.randn(32, 672, 7) # Batch, Length, Channel
batch_y = torch.randn(32, 96, 7) # Batch, Length, Channel
loss = model(batch_x, batch_y)
loss.backward()
# 5. Inference
model.eval()
with torch.no_grad():
predictions = model(batch_x)
# 6. Save
model.save_pretrained("./dualweaver_model")
# 7. Load
loaded_model = DualWeaverModel.from_pretrained("./dualweaver_model")
Citation
If you find this useful or use it in your research, please consider citing the DualWeaver paper:
@misc{li2026dualweaversynergisticfeatureweaving,
title={DualWeaver: Synergistic Feature Weaving Surrogates for Multivariate Forecasting with Univariate Time Series Foundation Models},
author={Jinpeng Li and Zhongyi Pei and Huaze Xue and Bojian Zheng and Chen Wang and Jianmin Wang},
year={2026},
eprint={2602.22066},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2602.22066},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dualweaver-0.1.0.tar.gz.
File metadata
- Download URL: dualweaver-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ad62f6b7d70cd2a714a1bdb2743334c90ad9796709df8d62d5a5b70131358bf
|
|
| MD5 |
37f2e753ddba879f044a754f2511f055
|
|
| BLAKE2b-256 |
ca7d6c9da7c124ebffb76fafa47cdfb1dc1298ee8bd1f5c676d6b068c700cad9
|
File details
Details for the file dualweaver-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dualweaver-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9e1e8cd0cbb9c0527723a74c352a5aa8b5608cea87b3128b99dc65fa7db2427
|
|
| MD5 |
e28791fe92ebcf358bc44ce50341d2a3
|
|
| BLAKE2b-256 |
5b5f8e12b701e18aa12f01c500753d399be45515eb0cf082976ba11e7924b1d6
|