Skip to main content

ML runtime (https://pypi.org/project/fdq/)

Project description

FDQ | Fonduecaquelon

Fonduecaquelon (FDQ) is designed for researchers and practitioners who want to focus on deep learning experiments, not boilerplate code. FDQ streamlines your PyTorch workflow, automating repetitive tasks and providing a flexible, extensible framework for experiment management—so you can spend more time on innovation and less on setup.


🚀 Features

  • Minimal Boilerplate: Define only what matters — FDQ handles the rest.
  • Flexible Experiment Configuration: Use JSON config files with inheritance support for easy experiment management.
  • Multi-Model Support: Seamlessly manage multiple models, losses, and data loaders.
  • Cluster Ready: Effortlessly submit jobs to SLURM clusters with built-in utilities.
  • Extensible: Easily integrate custom models, data loaders, and training/testing loops.
  • Automatic Dependency Management: Install additional pip packages per experiment.
  • Distributed Training: Out-of-the-box support for distributed training using PyTorch DDP.

🛠️ Installation

Install the latest release from PyPI:

pip install fdq

Or, for development and the latest features, clone the repository:

git clone https://github.com/mstadelmann/fonduecaquelon.git
cd fonduecaquelon
pip install -e .

📖 Usage

Local Experiments

All experiment parameters are defined in a config file. Config files can inherit from a parent file for easy reuse and organization.

To run an experiment locally:

fdq <path_to_config_file.json>

SLURM Cluster Execution

To run experiments on a SLURM cluster, add a slurm_cluster section to your config. See this example.

Submit your experiment to the cluster:

python <path_to>/fdq_submit.py <path_to_config_file.json>

⚙️ Configuration Overview

FDQ uses JSON configuration files to define experiments. These files specify models, data loaders, training/testing scripts, and cluster settings.

Models

Models are defined as dictionaries. You can use pre-installed models (e.g., Chuchichaestli) or your own. Example:

"models": {
    "ccUNET": {
        "class_name": "chuchichaestli.models.unet.unet.UNet"
    }
}

Access models in your training loop via experiment.models["ccUNET"]. The same structure applies to losses and data loaders.

Data Loaders

Your data loader class must implement a create_datasets(experiment, args) function, returning a dictionary like:

return {
    "train_data_loader": train_loader,
    "val_data_loader": val_loader,
    "test_data_loader": test_loader,
    "n_train_samples": n_train,
    "n_val_samples": n_val,
    "n_test_samples": n_test,
    "n_train_batches": len(train_loader),
    "n_val_batches": len(val_loader) if val_loader is not None else 0,
    "n_test_batches": len(test_loader),
}

These values are accessible from your training loop as experiment.data["<name>"].<key>.

Training Loop

Specify the path to your training script in the config. FDQ expects a function:

def fdq_train(experiment: fdqExperiment):

Within this function, you can access all experiment components:

nb_epochs = experiment.exp_def.train.args.epochs
data_loader = experiment.data["OXPET"].train_data_loader
model = experiment.models["ccUNET"]

See train_oxpets.py for a full example.

Testing Loop

Testing works similarly. Define a function:

def fdq_test(experiment: fdqExperiment):

See oxpets_test.py for an example.


📦 Installing Additional Python Packages

If your experiment requires extra Python packages, specify them in your config under additional_pip_packages. FDQ will install them automatically before running your experiment.

Example:

"slurm_cluster": {
    "fdq_version": "0.0.47",
    "...": "...",
    "additional_pip_packages": [
        "monai==1.4.0",
        "prettytable"
    ]
}

📝 Tips

  • Config Inheritance: Use the parent key in your config to inherit settings from another file, reducing duplication.
  • Multiple Models/Losses: FDQ supports multiple models and losses per experiment — just add them to the config dictionaries.
  • Cluster Submission: The fdq_submit.py utility handles SLURM job script generation and submission, including environment setup and result copying.

📚 Resources


🤝 Contributing

Contributions are welcome! Please open issues or pull requests on GitHub.


🧀 Enjoy your fondue and happy experimenting!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fdq-0.0.47.tar.gz (69.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fdq-0.0.47-py3-none-any.whl (58.7 kB view details)

Uploaded Python 3

File details

Details for the file fdq-0.0.47.tar.gz.

File metadata

  • Download URL: fdq-0.0.47.tar.gz
  • Upload date:
  • Size: 69.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for fdq-0.0.47.tar.gz
Algorithm Hash digest
SHA256 c47d8fe5f49b088536ca53b20c2fb3b29f832dba57808490a6862798816ecf25
MD5 6b969b0057a72fc8a5e49bfbd8691415
BLAKE2b-256 a66f2c1e4cf2884ec5280e4a2f536e6b90ecc1a6a3b9c29135f670a9b186c6b2

See more details on using hashes here.

File details

Details for the file fdq-0.0.47-py3-none-any.whl.

File metadata

  • Download URL: fdq-0.0.47-py3-none-any.whl
  • Upload date:
  • Size: 58.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for fdq-0.0.47-py3-none-any.whl
Algorithm Hash digest
SHA256 2abd81a66db4e625d91babf31ec3a6a98b0f7392bef0e3e866b3c9965d8cb042
MD5 132095528d6046300e890b792e375e4a
BLAKE2b-256 a9769d6e05f36f804540195853cdc6ab5257aec06d97f7a849e8827d66f1e920

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page