Giter VIP home page Giter VIP logo

earth2mip's Introduction

Earth-2 MIP (Beta)

Project Status: Active - The project has reached a stable, usable state and is being actively developed. GitHub Documentstion codecov Python versionm: 3.10, 3.11, 3.12 Code style: black

Earth-2 Model Intercomparison Project (MIP) is a Python based AI framework that enables climate researchers and scientists to explore and experiment with the use of AI models for weather and climate. It provides reference workflows for understanding how AI models capture the physics of the Earth's atmosphere and how they can work with traditional numerical weather forecasting models. For instance, the repo provides a uniform interface for running inference using pre-trained model checkpoints and scoring the skill of such models using certain standard metrics. This repository is meant to facilitate the weather and climate community to come up with good reference baseline of events to test the models against and to use with a variety of data sources.

Installation

Earth-2 MIP will be installable on PyPi upon general release. In the mean time, one can install from source:

git clone [email protected]:NVIDIA/earth2mip.git

cd earth2mip && pip install .

See installation documentation for more details and other options.

Getting Started

Earth-2 MIP provides a set of examples which can be viewed on the examples documentation page which can be used to get started with various workflows. These examples can be downloaded both as Jupyer Notebooks and Python scripts. The source Python scripts can be found in the examples folders.

Basic Inference

Earth-2 MIP provides high-level APIs for running inference with AI models. For example, the following can be used to run Pangu weather using an initial state from the climate data store (CDS):

python
>>> import datetime
>>> from earth2mip.networks import get_model
>>> from earth2mip.initial_conditions import cds
>>> from earth2mip.inference_ensemble import run_basic_inference
>>> time_loop  = get_model("e2mip://dlwp", device="cuda:0")
>>> data_source = cds.DataSource(time_loop.in_channel_names)
>>> ds = run_basic_inference(time_loop, n=10, data_source=data_source, time=datetime.datetime(2018, 1, 1))
>>> ds.chunk()
<xarray.DataArray (time: 11, history: 1, channel: 69, lat: 721, lon: 1440)>
dask.array<xarray-<this-array>, shape=(11, 1, 69, 721, 1440), dtype=float32, chunksize=(11, 1, 69, 721, 1440), chunktype=numpy.ndarray>
Coordinates:
  * lon      (lon) float32 0.0 0.25 0.5 0.75 1.0 ... 359.0 359.2 359.5 359.8
  * lat      (lat) float32 90.0 89.75 89.5 89.25 ... -89.25 -89.5 -89.75 -90.0
  * time     (time) datetime64[ns] 2018-01-01 ... 2018-01-03T12:00:00
  * channel  (channel) <U5 'z1000' 'z925' 'z850' 'z700' ... 'u10m' 'v10m' 't2m'
Dimensions without coordinates: history

And you can get ACC/RMSE like this:

>>> from earth2mip.inference_medium_range import score_deterministic
>>> import numpy as np
>>> scores = score_deterministic(time_loop,
    data_source=data_source,
    n=10,
    initial_times=[datetime.datetime(2018, 1, 1)],
    # fill in zeros for time-mean, will typically be grabbed from data.
    time_mean=np.zeros((7, 721, 1440))
)
>>> scores
<xarray.Dataset>
Dimensions:        (lead_time: 11, channel: 7, initial_time: 1)
Coordinates:
  * lead_time      (lead_time) timedelta64[ns] 0 days 00:00:00 ... 5 days 00:...
  * channel        (channel) <U5 't850' 'z1000' 'z700' ... 'z300' 'tcwv' 't2m'
Dimensions without coordinates: initial_time
Data variables:
    acc            (lead_time, channel) float64 1.0 1.0 1.0 ... 0.9686 0.9999
    rmse           (lead_time, channel) float64 0.0 2.469e-05 0.0 ... 7.07 2.998
    initial_times  (initial_time) datetime64[ns] 2018-01-01
>>> scores.rmse.sel(channel='z500')
<xarray.DataArray 'rmse' (lead_time: 11)>
array([  0.        , 150.83014446, 212.07880612, 304.98592282,
       381.36510987, 453.31516952, 506.01464974, 537.11092269,
       564.79603347, 557.22871627, 586.44691243])
Coordinates:
  * lead_time  (lead_time) timedelta64[ns] 0 days 00:00:00 ... 5 days 00:00:00
    channel    <U5 'z500'

Supported Models

These notebooks illustrate how-to-use with a few models and this can serve as reference to bring in your own checkpoint as long as it's compatible. There may be additional work to make it compatible with Earth-2 MIP. Earth-2 MIP leverages the model zoo in Modulus to provide a reference set of base-line models. The goal is to enable to community to grow this collection of models as shown in the table below.

ID Model Architecture Type Reference Source Size
fcn FourCastNet Adaptive Fourier Neural Operator global weather Arxiv modulus 300Mb
dlwp Deep Learning Weather Prediction Convolutional Encoder-Decoder global weather AGU modulus 50Mb
pangu Pangu Weather (Hierarchical 6 + 24 hr) Vision Transformer global weather Nature onnx 2Gb
pangu_6 Pangu Weather 6hr Model Vision Transformer global weather Nature onnx 1Gb
pangu_24 Pangu Weather 24hr Model Vision Transformer global weather Nature onnx 1Gb
fcnv2_sm FourCastNet v2 Spherical Harmonics Fourier Neural Operator global weather Arxiv modulus 3.5Gb
graphcast Graphcast, 37 levels, 0.25 deg Graph neural network global weather Science github 145MB
graphcast_small Graphcast, 13 levels, 1 deg Graph neural network global weather Science github 144MB
graphcast_operational Graphcast, 13 levels, 0.25 deg Graph neural network global weather Science github 144MB
precipitation_afno FourCastNet Precipitation Adaptive Fourier Neural Operator diagnostic Arxiv modulus 300Mb
climatenet ClimateNet Segmentation Model Convolutional Neural Network diagnostic GMD modulus 2Mb

* = coming soon

Some models require additional dependencies not installed by default. Refer to the installation instructions for details.

Note : Each model checkpoint may have its own unique license. We encourage users to familiarize themselves with each to understand implications for their particular use case.

We want to integrate your model into the scoreboard to show the community! The best way to do this is via NVIDIA Modulus. You can contribute your model (both the training code as well as model checkpoint) and we can ensure that it is maintained as part of the reference set.

Contributing

Earth-2 MIP is an open source collaboration and its success is rooted in community contribution to further the field. Thank you for contributing to the project so others can build on your contribution. For guidance on making a contribution to Earth-2 MIP, please refer to the contributing guidelines.

More About Earth-2 MIP

This work is inspired to facilitate similar engagements between teams here at NVIDIA - the ML experts developing new models and the domain experts in Climate science evaluating the skill of such models. For instance, often necessary input data such as normalization constants and hyperparameter values are not packaged alongside the model weights. Every model typically implements a slightly different interface. Scoring routines are specific to the model being scored and may not be consistent across groups.

Earth-2 MIP addresses these challenges and bridges the gap between the domain experts who most often are assessing ML models, and the ML experts producing them. Compared to other projects in this space, Earth-2 MIP focuses on scoring models on-the-fly. It has python APIs suitable for rapid iteration in a jupyter book, CLIs for scoring models distributed over many GPUs, and a flexible plugin framework that allows anyone to use their own ML models. More importantly Earth-2 MIP aspires to facilitate exploration and collaboration within the climate research community to evaluate the potential of AI models in climate and weather simulations.

Please see the documentation page for in depth information about Earth-2 MIP, functionality, APIs, etc.

Communication

  • Github Discussions: Discuss new ideas, model integration, support etc.
  • GitHub Issues: Bug reports, feature requests, install issues, etc.

License

Earth-2 MIP is provided under the Apache License 2.0, please see LICENSE.txt for full license text.

Additional Resources

earth2mip's People

Contributors

albetancurqu42 avatar ankurmahesh avatar chenggongwang avatar nbren12 avatar nickgeneva avatar omahs avatar yairchn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

earth2mip's Issues

๐Ÿ›[BUG]: running pangu weather in the ensemble notebook (with inference ensembles) breaks

Version

source -main

On which installation method(s) does this occur?

No response

Describe the issue

if I try to run the ensemble notebook with pangu as the weather model I get
File "/usr/local/lib/python3.10/dist-packages/earth2mip/inference_ensemble.py", line 135, in run_ensembles
iterator = model(time, x, normalize=False)
TypeError: PanguInference.call() got an unexpected keyword argument 'normalize'

Environment details

interactive session with this container 
`gitlab-master.nvidia.com/earth-2/fcn-mip:latest`

๐Ÿ›[BUG]: occasional error downloading pangu

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

I get this error sometimes

INFO:/root/earth2mip/earth2mip/model_registry.py:Downloading Pangu 6hr / 24hr model checkpoints, this may take a bit
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/earth2mip/earth2mip/inference_medium_range.py", line 301, in <module>
    main()
  File "/root/earth2mip/earth2mip/inference_medium_range.py", line 279, in main
    model = _cli_utils.model_from_args(args, dist.device)
  File "/root/earth2mip/earth2mip/_cli_utils.py", line 41, in model_from_args
    return networks.get_model(args.model, device=device, metadata=metadata)
  File "/root/earth2mip/earth2mip/networks/__init__.py", line 337, in get_model
    package = registry.get_model(model)
  File "/root/earth2mip/earth2mip/model_registry.py", line 222, in get_model
    return self.get_builtin_model(name)
  File "/root/earth2mip/earth2mip/model_registry.py", line 237, in get_builtin_model
    return PanguPackage(self.get_path(name), seperator=self.SEPERATOR)
  File "/root/earth2mip/earth2mip/model_registry.py", line 186, in PanguPackage
    urllib.request.urlretrieve(
  File "/usr/lib/python3.10/urllib/request.py", line 280, in urlretrieve
    raise ContentTooShortError(
urllib.error.ContentTooShortError: <urlopen error retrieval incomplete: got only 38451195 out of 1181711187 bytes>

Environment details

No response

๐Ÿ›[BUG]: ModuleNotFoundError: No module named 'modulus.utils.zenith_angle'

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

Known bug at the moment due to graph cast addition / upstreamed fixes needed from Modulus. Documenting here for users with temporary fix below when installing from source.

pip install .
pip install -r requirements.txt

Environment details

No response

๐Ÿ“š[DOC]: Update Issue / PR Templates

How would you describe the priority of this documentation request

Critical (currently preventing usage)

Is this for new documentation, or an update to existing docs?

New

Describe the incorrect/future/missing documentation

Update PR templates to include check for linking to issue

Update issue template:

  • Add auto labels
  • Change default version options to jut "source"
  • Reduce complexity of bug template

๐Ÿš€[FEA]: Load forecast from GFS data source

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

Currently, GFS only supports loading from the analysis (initial condition), but it's simple to also work with forecasts. We can add a forecast step configuration.

Describe any alternatives you have considered

No response

๐Ÿ›[BUG]: Fix GFS data source

Version

Current

On which installation method(s) does this occur?

No response

Describe the issue

GFS data source is presently not running when you pip install. The JSON files are not included:

File "<dir>/conda-envs/earth2mip/lib/python3.10/pathlib.py", line 1119, in open
   return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: `<dir>/conda-envs/earth2mip/lib/python
3.10/site-packages/earth2mip/datasets/gfs/data73var.json'

Environment details

No response

๐Ÿš€[FEA]: Update Earth2MIP to Modulus 23.09

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

-this includes updating the packages to new checkpoint system

Describe any alternatives you have considered

No response

๐Ÿš€[FEA]: Get diagnostic models up on NGC model registry

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

Need to get both climate net and the precip model to the NGC model registry and get it hooked up

Describe any alternatives you have considered

No response

๐Ÿš€[FEA]: Add AFNO model

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Medium

Please provide a clear description of problem you would like to solve.

Add AFNO model from Modulus

Describe any alternatives you have considered

No response

Refactor: Use TimeLoop interface in inference_ensemlbe

For legacy reasons, inference_ensemble requires methods/attributes not present in the TimeLoop abstraction, and is tightly coupled to earth2mip.networks.Inference. The main source of coupling is related to normalization.

To get around this, the perturbation function should happen in physical units not in normalized values. Here are the steps that need to happen:

To do this:

Is that clear?

๐Ÿ›[BUG]: Earth-2 MIP should run on CPU mode

Version

main

On which installation method(s) does this occur?

Source

Describe the issue

Presently Earth-2 MIP fails for CPU runs because of some hard coded cuda() commands which should be swapped for .to(device) which should allow for CPU inference.

Environment details

No response

๐Ÿš€[FEA]: Add Apptainer support

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Medium

Please provide a clear description of problem you would like to solve.

Add apptainer support for running examples for those that cant run docker.

Describe any alternatives you have considered

No response

๐Ÿš€[FEA]: Add caching capabilities to data sources

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

Add ability for data-sources to cache the data locally on the machine and reuse it, instead of always downloading.

Describe any alternatives you have considered

No response

๐Ÿ›[BUG]: Fix dlwp workflow model registry location

Version

source

On which installation method(s) does this occur?

Source

Describe the issue

DLWP model registry does not work with the one generated by the notebook. Needs env variables to get set up.

Environment details

No response

๐Ÿ›[BUG]: README example not working with e2mip://fcn

Version

main

On which installation method(s) does this occur?

Pip

Describe the issue

I get this bug

In [3]: >>> import datetime
   ...: >>> from earth2mip.networks import get_model
   ...: >>> from earth2mip.initial_conditions import cds
   ...: >>> from earth2mip.inference_ensemble import run_basic_inference
   ...: >>> time_loop  = get_model("e2mip://fcn", device="cuda:0")
   ...: >>> data_source = cds.DataSource(time_loop.in_channel_names)
   ...: >>> ds = run_basic_inference(time_loop, n=10, data_source=data_source, time=datetime.datetime(2018, 1, 1))
   ...: >>> ds.chunk()

File ~/.local/lib/python3.10/site-packages/modulus/models/afno/afno.py:372, in PatchEmbed.forward(self, x)
    369 def forward(self, x: Tensor) -> Tensor:
    370     B, C, H, W = x.shape
    371     assert (
--> 372         H == self.img_size[0] and W == self.img_size[1]
    373     ), f"Input image size ({H}*{W}) doesn't match model ({self.img_size[0]}*{self.img_size[1]})."
    374     x = self.proj(x).flatten(2).transpose(1, 2)
    375     return x

AssertionError: Input image size (721*1440) doesn't match model (720*1440).

this is probably a bug in run_basic_inference.

Environment details

No response

๐Ÿ“š[DOC]: Add Code Snippet to Read Me

How would you describe the priority of this documentation request

Critical (currently preventing usage)

Is this for new documentation, or an update to existing docs?

New

Describe the incorrect/future/missing documentation

No response

๐Ÿ›[BUG]: Fix notebook one to not depend on python exe

Version

source

On which installation method(s) does this occur?

No response

Describe the issue

Right now notebook one demo a CLI command. This can cause some issues when relying on a ipython kernel in some Jupyter lab environments.

Environment details

No response

๐Ÿš€[FEA]: Add download function to known models

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Medium

Please provide a clear description of problem you would like to solve.

Add a download function inside models that can get called on load for known model packages that are not served on s3.

This should help enable better CLI use of built in models.

Describe any alternatives you have considered

No response

๐Ÿ“š[DOC]: Enhance config documentation / examples

How would you describe the priority of this documentation request

Critical (currently preventing usage)

Is this for new documentation, or an update to existing docs?

Update

Describe the incorrect/future/missing documentation

Improve config documentation to show options and also some more samples than what the notebooks provides

๐Ÿš€[FEA]: Set default MODEL_REGISTRY

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

When MODEL_REGISTRY is not set, e2mip will default to downloading models to "/", usually resulting in a permission error.

We can probably chose a default in the users home directory. .e.g .cache/e2mip/model-registry.

Describe any alternatives you have considered

No response

๐Ÿ›[BUG]: Unused import in DLWP Python script

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

Scipy import is not used in DLWP script. Left over from converting the pangu script

Environment details

No response

๐Ÿ›[BUG]: Fix NVColormap function in Notebook 1

Version

source

On which installation method(s) does this occur?

No response

Describe the issue

def Nvidia_cmap():
    colors = [(0.0, "white"), (1.0, "darkgreen")]  # (position, color)
    cmap = mcolors.LinearSegmentedColormap.from_list("custom_cmap", colors)
    return cmap

Change to

def Nvidia_cmap():
    colors = ['#456115', '#bfda8e']  # (position, color)
    cmap = mcolors.LinearSegmentedColormap.from_list("custom_cmap", colors)
    return cmap

Environment details

No response

๐Ÿ›[BUG]: Notebook errors with DLWP and Pangu

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

  • DLWP fails due to existing legacy code from channel set
  • Pangu fails due to missing field in perturb std file
  • Pangu inferencer missing device property

Environment details

No response

๐Ÿš€[FEA]: Add diagnostic concept and geofunction

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

Add support for diagnostic models. More information coming

Describe any alternatives you have considered

No response

๐Ÿš€[FEA]: Allow for injection of forcing (noise, perturbation or other) between model steps

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

For exploring ensemble forecast and for exploring the physical validity of these models (and other research goals) a method that can inject a perturbation with units of variables / dt (here dt is the model tilmestep) between model steps is needed.
I would like to collect suggestions of how to do that , different than PR #42 before starting to code

Describe any alternatives you have considered

see changes in #42

๐Ÿš€[FEA]: Enable perturbing a subset of the model variables

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

Currently the code applied an initial condition perturbation to all variables in a model. To allow a full exploration of the model it is useful to allow to perturb a subset of the variables, that if config specified for reproducibility. This is need for us and some of our collaborators to be able to migrate to using this code.

Describe any alternatives you have considered

No response

๐Ÿ›[BUG]: Race condition in parallel workflows

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

The model data is downloading by all ranks of a parallel job in parallel. This will result in corrupt files if the files haven't been download into the model registry yet.

Environment details

No response

๐Ÿš€[FEA]: Add "nudging" perturbation capabilities

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

This prescribed nudging is applied between steps, with units of var/day, where var could be dimensional or non dimensional depending on the model. A notebook for preforming a perturbation response experiment in earth2mip is added.

Describe any alternatives you have considered

No response

๐Ÿš€[FEA]: Gaussian Random Field Based Perturbation Method

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

Add this version of noise back into Earth-2 MIP

Describe any alternatives you have considered

No response

๐Ÿ›[BUG]: Fix Pangu Weather to work with Inferencer

Version

Current

On which installation method(s) does this occur?

Source

Describe the issue

Instead of making Pangu have the same defunct interface as earth2mip.networks.Inference, run_inference should be modified to work with objects obeying the earth2mip.time_loop.TimeLoop interface.I

Minimum reproducible example

No response

Relevant log output

No response

Environment details

No response

๐Ÿ›[BUG]: inconsistent meaning of "source"

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

source should be applied on physical units, for the same reasons that we decided to do this with the initial perturbation. Presumably the source will also need to know about channel names in order to perturb the correct variable.

@yairchn

Environment details

No response

Design TimeStepper abstraction

to allow custom time looping in an extensible manner we need a new abstraction. #42 for example requires touching both model code and inference_ensemble---these routines are too tightly coupled. Exposing an iterator interface as TimeLoop does is not enough for use-cases like diagnostic models or time dependent forcing which works for various models.

To control the timestep we should define a TimeStepper abstraction. Does this name seem okay?

Here is a proposed interface:

State = Tuple[Tensor, datetime]
Outputs = Tensor

class TimeStepper:
	"""Callable time stepper

	Updates the state and returns some outputs.

	The state contains time and a tensor of data representing the domain.

	The outputs are diagnostics outputs not required for time-stepping, but useful.

	Attributes:
			state_metadata: information about the state object, dimensions of the tensor, channels, grid, etc
			output_metadata: information about the outputs, dimensions etc.


	Examples:

		stepper : TimeStepper = ...
		state = get_initial_condition(time)
		channel_to_save = "tcwv"
		for i in range(n):
			state, output = stepper(state)
			idx = stepper.output_metadata.index(channel_to_save)
			tcwv = state.data[idx]
			plt.pcolormesh(tcwv)
			plt.savefig(f"{i}.png")

	"""

	def __call__(self, state: State) -> Tuple[State, Outputs]:

thoughts @NickGeneva?

๐Ÿ›[BUG]: Get Pangu models to functions with GFS

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

Presently GFS does not support Pangu channel set. Should probably just add it with the channel set for now and update to more general schema later

Environment details

No response

๐Ÿ“š[DOC]: Readme Grammar

How would you describe the priority of this documentation request

Critical (currently preventing usage)

Is this for new documentation, or an update to existing docs?

New

Describe the incorrect/future/missing documentation

Literally first sentence "is a python"

๐Ÿš€[FEA]: Using noise injection between steps as model perturbation

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem you would like to solve.

To account for model uncertainties in ensemble forecasting we need to enable perturbing the model. The simplest way to achieve this is injecting noise between steps. It is important that the type of noise injection and amplitude will be determined from the config file.

Describe any alternatives you have considered

No response

๐Ÿ›[BUG]: era5.HDF5Source broken

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

  • AttributeError: 'HDF5DataSource' object has no attribute 'grid'
  • shape of output is (h, c, y, x) but should be (c, y, x)

we should add coverage for these use case. mypy should be able to catch the first (#52). the second requires a test to assert the shape is as expected at run time.

Environment details

No response

๐Ÿš€[FEA]: NGC File system for ZIP model package files on NGC

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Medium

Please provide a clear description of problem you would like to solve.

The File system should support the use of NGC model registry natively and download files with urls such as ngc://model_url. The existing NGC packages should then be cleaned up to use this feature.

This includes then cleaning up the built in packages.

Some additional discussion is found here: #55

Describe any alternatives you have considered

No response

๐Ÿ›[BUG]: score_ensemble_outputs glob load inconsistent ordering

Version

Current

On which installation method(s) does this occur?

Source

Describe the issue

Glob load of netcdf files is not ordered.

If the load occurs out of order this can lead to issues such that the 0th loaded netCDF does not actually correspond to the 0th netCDF file saved.

Minimum reproducible example

No response

Relevant log output

No response

Environment details

No response

๐Ÿ“š[DOC]: Improve Singularity docs

How would you describe the priority of this documentation request

Critical (currently preventing usage)

Is this for new documentation, or an update to existing docs?

New

Describe the incorrect/future/missing documentation

Improve singularity docs for running examples with bind location, pip install command, remove unnecessary flags, etc.

๐Ÿ›[BUG]: AFNO "fcn" broken in more recent versions of modulus

Version

main

On which installation method(s) does this occur?

No response

Describe the issue

https://github.com/NVIDIA/modulus/blame/ef54c7a4c3b241c48f48695362c2688d150c6ce5/modulus/models/afno/afno.py#L414 changed the kwargs of AFNO, so the fcn package now fails. with this error

__________________________________________________________________________________________________________________________________________________________________________________________________________________ test_run_basic_inference ____________________________________________________________________________________________________________________________________________________________________________________________________________________

    @pytest.mark.slow
    def test_run_basic_inference():
>       time_loop = get_model("e2mip://fcn", device="cuda:0")

tests/test_end_to_end.py:134: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
earth2mip/networks/__init__.py:335: in get_model
    return _load_package_builtin(package, device, name=url.netloc)
earth2mip/networks/__init__.py:282: in _load_package_builtin
    return inference_loader(package, device=device)
earth2mip/networks/fcn.py:64: in load
    core_model = modulus.Module.from_checkpoint(package.get("fcn.mdlus"))
/usr/local/lib/python3.10/dist-packages/modulus/models/module.py:327: in from_checkpoint
    model = cls.instantiate(args)
/usr/local/lib/python3.10/dist-packages/modulus/models/module.py:150: in instantiate
    return _cls(**arg_dict["__args__"])
/usr/local/lib/python3.10/dist-packages/modulus/models/module.py:59: in __new__
    bound_args = sig.bind_partial(
/usr/lib/python3.10/inspect.py:3193: in bind_partial
    return self._bind(args, kwargs, partial=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Signature (self, inp_shape: List[int], in_channels: int, out_channels: int, patch_size: List[int] = [16, 16], embed_d... float = 0.0, num_blocks: int = 16, sparsity_threshold: float = 0.01, hard_thresholding_fraction: float = 1.0) -> None>, args = (None,), kwargs = {'img_size': [720, 1440]}

    def _bind(self, args, kwargs, *, partial=False):
        """Private method. Don't use directly."""
    
        arguments = {}
    
        parameters = iter(self.parameters.values())
        parameters_ex = ()
        arg_vals = iter(args)
    
        while True:
            # Let's iterate through the positional arguments and corresponding
            # parameters
            try:
                arg_val = next(arg_vals)
            except StopIteration:
                # No more positional arguments
                try:
                    param = next(parameters)
                except StopIteration:
                    # No more parameters. That's it. Just need to check that
                    # we have no `kwargs` after this while loop
                    break
                else:
                    if param.kind == _VAR_POSITIONAL:
                        # That's OK, just empty *args.  Let's start parsing
                        # kwargs
                        break
                    elif param.name in kwargs:
                        if param.kind == _POSITIONAL_ONLY:
                            msg = '{arg!r} parameter is positional only, ' \
                                  'but was passed as a keyword'
                            msg = msg.format(arg=param.name)
                            raise TypeError(msg) from None
                        parameters_ex = (param,)
                        break
                    elif (param.kind == _VAR_KEYWORD or
                                                param.default is not _empty):
                        # That's fine too - we have a default value for this
                        # parameter.  So, lets start parsing `kwargs`, starting
                        # with the current parameter
                        parameters_ex = (param,)
                        break
                    else:
                        # No default, not VAR_KEYWORD, not VAR_POSITIONAL,
                        # not in `kwargs`
                        if partial:
                            parameters_ex = (param,)
                            break
                        else:
                            msg = 'missing a required argument: {arg!r}'
                            msg = msg.format(arg=param.name)
                            raise TypeError(msg) from None
            else:
                # We have a positional argument to process
                try:
                    param = next(parameters)
                except StopIteration:
                    raise TypeError('too many positional arguments') from None
                else:
                    if param.kind in (_VAR_KEYWORD, _KEYWORD_ONLY):
                        # Looks like we have no parameter for this positional
                        # argument
                        raise TypeError(
                            'too many positional arguments') from None
    
                    if param.kind == _VAR_POSITIONAL:
                        # We have an '*args'-like argument, let's fill it with
                        # all positional arguments we have left and move on to
                        # the next phase
                        values = [arg_val]
                        values.extend(arg_vals)
                        arguments[param.name] = tuple(values)
                        break
    
                    if param.name in kwargs and param.kind != _POSITIONAL_ONLY:
                        raise TypeError(
                            'multiple values for argument {arg!r}'.format(
                                arg=param.name)) from None
    
                    arguments[param.name] = arg_val
    
        # Now, we iterate through the remaining parameters to process
        # keyword arguments
        kwargs_param = None
        for param in itertools.chain(parameters_ex, parameters):
            if param.kind == _VAR_KEYWORD:
                # Memorize that we have a '**kwargs'-like parameter
                kwargs_param = param
                continue
    
            if param.kind == _VAR_POSITIONAL:
                # Named arguments don't refer to '*args'-like parameters.
                # We only arrive here if the positional arguments ended
                # before reaching the last parameter before *args.
                continue
    
            param_name = param.name
            try:
                arg_val = kwargs.pop(param_name)
            except KeyError:
                # We have no value for this parameter.  It's fine though,
                # if it has a default value, or it is an '*args'-like
                # parameter, left alone by the processing of positional
                # arguments.
                if (not partial and param.kind != _VAR_POSITIONAL and
                                                    param.default is _empty):
                    raise TypeError('missing a required argument: {arg!r}'. \
                                    format(arg=param_name)) from None
    
            else:
                if param.kind == _POSITIONAL_ONLY:
                    # This should never happen in case of a properly built
                    # Signature object (but let's have this check here
                    # to ensure correct behaviour just in case)
                    raise TypeError('{arg!r} parameter is positional only, '
                                    'but was passed as a keyword'. \
                                    format(arg=param.name))
    
                arguments[param_name] = arg_val
    
        if kwargs:
            if kwargs_param is not None:
                # Process our '**kwargs'-like parameter
                arguments[kwargs_param.name] = kwargs
            else:
>               raise TypeError(
                    'got an unexpected keyword argument {arg!r}'.format(
                        arg=next(iter(kwargs))))
E               TypeError: got an unexpected keyword argument 'img_size'

Environment details

nvidia-modulus @ https://github.com/nbren12/modulus/archive/refs/heads/tisr.tar.gz#sha256=84f7044c4cb030d30aa1b4a55ca25af90fe7bdb45252c3e7738896274dcea609

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.