Wandb-fortran: Using W&B for ML training and hyperparameter optimisation in Fortran

Hi all,

I have just released wandb-fortran , a small library that allows Fortran programs to log experiments directly to Weights & Biases (wandb/W&B, https://wandb.ai) and use W&B’s automated hyperparameter optimisation features (sweeps) directly in Fortran code.

The library provides an interface for sending metrics, configuration values, and run information from Fortran codes to the W&B experiment tracking platform. The goal is to make it easier to monitor, compare, and automate hyperparameter optimisation (using the sweep feature of W&B) of machine learning experiments performed in Fortran in the same way Python enables through its W&B package. The library is called directly inline in your Fortran code.

Repository: GitHub - nedtaylor/wandb-fortran: Fortran interface for Weights & Biases to enable training metrics logging and sweeps directly in Fortran · GitHub

One of the goals of wandb-fortran is that it is completely independent of any particular neural network framework . Rather than tightly coupling the interface to one library, it simply provides a logging interface that any Fortran code can call.

Because of this, the repository currently includes examples demonstrating usage with several different Fortran ML libraries:

  • athena
  • neural-fortran
  • fiats (note, example uses version 0.14, i.e. latest version supporting gfortran, as most of my testing is done with gfortran, but should work with newer versions of fiats)

This should make it straightforward to integrate experiment tracking into a wide range of existing Fortran machine learning workflows.

AI-assisted development

This project was largely built using AI coding assistance (specifically Claude models). Because of that, this should be considered an early version while I continue testing and validating the code that has been generated.

If anyone is interested in experimenting with Weights & Biases tracking from Fortran, feedback and contributions would be very welcome.

Feel free to ask any questions or share any suggestions!

3 Likes