Views
No views yet
1import hydra
2import yaml
3from huggingface_hub import snapshot_download
4from safetensors.torch import load_model
5
6
7REPO_ID = "openclimatefix/cloudcasting_example_models"
8REVISION = None # None for latest or set <commit-id>
9MODEL = "simvp_model" # simvp_model or earthformer_model
10
11# Download the model checkpoints
12hf_download_dir = snapshot_download(
13 repo_id=REPO_ID,
14 revision=REVISION,
15)
16
17# Create the model object
18with open(f"{hf_download_dir}/{MODEL}/model_config.yaml", "r", encoding="utf-8") as f:
19 model = hydra.utils.instantiate(yaml.safe_load(f))
20
21# Load the model weights
22load_model(
23 model,
24 filename=f"{hf_download_dir}/{MODEL}/model.safetensors",
25 strict=True,
26)from huggingface_hub import snapshot_download
from ocf_iam4vp import IAM4VPLightning
REPO_ID = "openclimatefix/cloudcasting_example_models"
REVISION = None # None for latest or set <commit-id>
# Download the model checkpoints
hf_download_dir = snapshot_download(
repo_id=REPO_ID,
revision=REVISION,
)
model = IAM4VPLightning.load_from_checkpoint(
f"{hf_download_dir}/iam4vp/iam4vp_checkpoint_0.4.3.ckpt",
num_forecast_steps=12,
).model