mllam / neural-lam

Neural Weather Prediction for Limited Area Modeling
MIT License
64 stars 24 forks source link

Refactor codebase into a python package #32

Open leifdenby opened 1 month ago

leifdenby commented 1 month ago

This PR lays the groundwork for being able to install neural-lam as a package, thereby making it possible to run from anywhere once the package has been installed. This means that it would be possible (in theory) to train neural-lam on a .npy-file based dataset (once https://github.com/mllam/neural-lam/pull/31 has been merged so that the training configuration is moved from neural_lam/constants.py to a yaml-config file) with the neural-lam package installed into a user's site-packages (i.e. in their virtualenv).

I appreciate that currently most of us will be checking out the codebase to make modifications, and then train a model with neural-lam and so these changes might seem superfluous. But making these later will be a lot harder than doing them now.

The primary changes are:

I still need to resolve the issue around depending on cpu or gpu versions of pytorch. I know @sadamov found a work-around where the cpu or gpu package was automatically picked based on whether CUDA is detected. I haven't had time to look into this yet, but once I have done that I will mark this PR as complete from my side and ask for your thoughts on it :)

This PR is definitely a work-in-progress and is meant to serve as a discussion point.

(also this PR includes changes that PR #29 adds, so this PR definitely shouldn't be merged or even reviewed probably before #29 is in)