Salesforce / moirai-1.0-R-small

huggingface.co
Total runs: 26.3K
24-hour runs: 0
7-day runs: 8.4K
30-day runs: 3.7K
Model's Last Updated: January 21 2025
time-series-forecasting

Introduction of moirai-1.0-R-small

Model Details of moirai-1.0-R-small

Moirai-1.0-R-Small

Moirai, the Masked Encoder-based Universal Time Series Forecasting Transformer is a Large Time Series Model pre-trained on LOTSA data . For more details on the Moirai architecture, training, and results, please refer to the paper .


Fig. 1: Overall architecture of Moirai. Visualized is a 3-variate time series, where variates 0 and 1 are target variables (i.e. to be forecasted, and variate 2 is a dynamic covariate (values in forecast horizon known). Based on a patch size of 64, each variate is patchified into 3 tokens. The patch embeddings along with sequence and variate id are fed into the Transformer. The shaded patches represent the forecast horizon to be forecasted, whose corresponding output representations are mapped into the mixture distribution parameters.

Usage

To perform inference with Moirai, install the uni2ts library from our GitHub repo .

  1. Clone repository:
git clone https://github.com/SalesforceAIResearch/uni2ts.git
cd uni2ts
  1. Create virtual environment:
virtualenv venv
. venv/bin/activate
  1. Build from source:
pip install -e '.[notebook]'
  1. Create a .env file:
touch .env

A simple example to get started:

import torch
import matplotlib.pyplot as plt
import pandas as pd
from gluonts.dataset.pandas import PandasDataset
from gluonts.dataset.split import split

from uni2ts.eval_util.plot import plot_single
from uni2ts.model.moirai import MoiraiForecast, MoiraiModule


SIZE = "small"  # model size: choose from {'small', 'base', 'large'}
PDT = 20  # prediction length: any positive integer
CTX = 200  # context length: any positive integer
PSZ = "auto"  # patch size: choose from {"auto", 8, 16, 32, 64, 128}
BSZ = 32  # batch size: any positive integer
TEST = 100  # test set length: any positive integer

# Read data into pandas DataFrame
url = (
    "https://gist.githubusercontent.com/rsnirwan/c8c8654a98350fadd229b00167174ec4"
    "/raw/a42101c7786d4bc7695228a0f2c8cea41340e18f/ts_wide.csv"
)
df = pd.read_csv(url, index_col=0, parse_dates=True)

# Convert into GluonTS dataset
ds = PandasDataset(dict(df))

# Split into train/test set
train, test_template = split(
    ds, offset=-TEST
)  # assign last TEST time steps as test set

# Construct rolling window evaluation
test_data = test_template.generate_instances(
    prediction_length=PDT,  # number of time steps for each prediction
    windows=TEST // PDT,  # number of windows in rolling window evaluation
    distance=PDT,  # number of time steps between each window - distance=PDT for non-overlapping windows
)

# Prepare pre-trained model by downloading model weights from huggingface hub
model = MoiraiForecast(
    module=MoiraiModule.from_pretrained(f"Salesforce/moirai-1.0-R-{SIZE}"),
    prediction_length=PDT,
    context_length=CTX,
    patch_size=PSZ,
    num_samples=100,
    target_dim=1,
    feat_dynamic_real_dim=ds.num_feat_dynamic_real,
    past_feat_dynamic_real_dim=ds.num_past_feat_dynamic_real,
)

predictor = model.create_predictor(batch_size=BSZ)
forecasts = predictor.predict(test_data.input)

input_it = iter(test_data.input)
label_it = iter(test_data.label)
forecast_it = iter(forecasts)

inp = next(input_it)
label = next(label_it)
forecast = next(forecast_it)

plot_single(
    inp, 
    label, 
    forecast, 
    context_length=200,
    name="pred",
    show_label=True,
)
plt.show()
The Moirai Family
Citation

If you're using Uni2TS in your research or applications, please cite it using this BibTeX:

@article{woo2024unified,
  title={Unified Training of Universal Time Series Forecasting Transformers},
  author={Woo, Gerald and Liu, Chenghao and Kumar, Akshat and Xiong, Caiming and Savarese, Silvio and Sahoo, Doyen},
  journal={arXiv preprint arXiv:2402.02592},
  year={2024}
}

Runs of Salesforce moirai-1.0-R-small on huggingface.co

26.3K
Total runs
0
24-hour runs
1.7K
3-day runs
8.4K
7-day runs
3.7K
30-day runs

More Information About moirai-1.0-R-small huggingface.co Model

More moirai-1.0-R-small license Visit here:

https://choosealicense.com/licenses/cc-by-nc-4.0

moirai-1.0-R-small huggingface.co

moirai-1.0-R-small huggingface.co is an AI model on huggingface.co that provides moirai-1.0-R-small's model effect (), which can be used instantly with this Salesforce moirai-1.0-R-small model. huggingface.co supports a free trial of the moirai-1.0-R-small model, and also provides paid use of the moirai-1.0-R-small. Support call moirai-1.0-R-small model through api, including Node.js, Python, http.

moirai-1.0-R-small huggingface.co Url

https://huggingface.co/Salesforce/moirai-1.0-R-small

Salesforce moirai-1.0-R-small online free

moirai-1.0-R-small huggingface.co is an online trial and call api platform, which integrates moirai-1.0-R-small's modeling effects, including api services, and provides a free online trial of moirai-1.0-R-small, you can try moirai-1.0-R-small online for free by clicking the link below.

Salesforce moirai-1.0-R-small online free url in huggingface.co:

https://huggingface.co/Salesforce/moirai-1.0-R-small

moirai-1.0-R-small install

moirai-1.0-R-small is an open source model from GitHub that offers a free installation service, and any user can find moirai-1.0-R-small on GitHub to install. At the same time, huggingface.co provides the effect of moirai-1.0-R-small install, users can directly use moirai-1.0-R-small installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

moirai-1.0-R-small install url in huggingface.co:

https://huggingface.co/Salesforce/moirai-1.0-R-small

Url of moirai-1.0-R-small

moirai-1.0-R-small huggingface.co Url

Provider of moirai-1.0-R-small huggingface.co

Salesforce
ORGANIZATIONS

Other API from Salesforce

huggingface.co

Total runs: 40.5K
Run Growth: -9.1K
Growth Rate: -21.71%
Updated: January 21 2025
huggingface.co

Total runs: 8.6K
Run Growth: 1.6K
Growth Rate: 19.06%
Updated: February 19 2024
huggingface.co

Total runs: 3.3K
Run Growth: 621
Growth Rate: 18.59%
Updated: January 25 2025
huggingface.co

Total runs: 588
Run Growth: 510
Growth Rate: 87.03%
Updated: January 21 2025
huggingface.co

Total runs: 547
Run Growth: 197
Growth Rate: 36.35%
Updated: January 21 2025
huggingface.co

Total runs: 290
Run Growth: 1
Growth Rate: 0.34%
Updated: January 15 2025
huggingface.co

Total runs: 50
Run Growth: -54
Growth Rate: -108.00%
Updated: January 15 2025