How to download model weights of Moirai into local and store and use it

#5
by Rajesh1996 - opened

I want to download model weights of Moirai into local and call instead of calling from hugging face can you please guide how we can do that.

Load model directly

from transformers import AutoModel
model = AutoModel.from_pretrained("Salesforce/moirai-1.0-R-large") Getting this error ValueError: Unrecognized model in Salesforce/moirai-1.0-R-large. Should have a model_type key in its config.json,

i have a similar problem, i try use:

model = MoiraiForecast.load_from_checkpoint(
checkpoint_path=hf_hub_download(
repo_id=f"Salesforce/moirai-1.0-R-{SIZE}", filename="model.ckpt"
),
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,
map_location="cuda:0" if torch.cuda.is_available() else "cpu",
)

but don't work. 1 month before it worked.

The weights have moved to .safetensors format

you guys can initialise the mode by
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,
)

This is available in the docs too

Sign up or log in to comment