Downloads · 30 days
0
ICCS/cam-ml-yog-v0
cam-ml-yog-v0 is a machine learning model from ICCS. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains a machine learning-based implementation of the convection parameterization in CAM (Community Atmosphere Model), leveraging PyTorch.
Downloads · 30 days
0
Access
Public
Updated Sep 10, 2024
Repo size
313 KB
Likes
0
Public
Click a slice to open those files.
.pt313 KB · 49%
From the Hugging Face model README
This repository contains a machine learning-based implementation of the convection parameterization in CAM (Community Atmosphere Model), leveraging PyTorch.
The model is a PyTorch adaptation of the original Fortran-based convection parameterization in CAM. It simulates subgrid-scale convection processes within a climate model and was developed to improve accuracy and efficiency.
This model was converted from the original CAM implementation by extracting the weights from Fortran and converting them into a PyTorch-compatible format. This conversion process involved the following steps:
To use the model in PyTorch, first install the necessary dependencies:
pip install torch huggingface_hub
Then, download and load the model as follows:
from huggingface_hub import hf_hub_download
import torch
# Download model weights
model_path = hf_hub_download(repo_id="ICCS/cam-ml-yog-v0", filename="model.pth")
# Load model (replace 'YourModel' with the appropriate model class from torch_nets/models.py)
model = YourModel()
model.load_state_dict(torch.load(model_path))
model.eval()
# Use the model for predictions
input_data = ... # Prepare your climate input data
output = model(input_data)
The model is designed to be easily fine-tuned using domain-specific climate data:
# Fine-tune the model
optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)
loss_fn = torch.nn.MSELoss()
# Example training loop
for epoch in range(epochs):
optimizer.zero_grad()
output = model(input_data)
loss = loss_fn(output, target_data)
loss.backward()
optimizer.step()
Please note that weight updates may be necessary as improvements are made to the model (see Issue #66).
For more details on the original implementation and how to contribute to the model’s development, see the GitHub repository.