πŸ’‘ Guideline

To install and use the library, it is recommended to create a Python virtual environment. You can do that with virtualenv, as follows:

Setting environement

pip install virtualenv
virtualenv -p <path/to/python3.10> myenv
source myenv/bin/activate

Installation

Once your virtual environment is activated, you can install the uqmodels library directly from Pypi by typing :

pip install robust-ml

This command will install the robust-ml package and all required dependencies.

Input/Output

Input

Advertrain takes a torch dataloader as input.

Ouput

As output, the library returns a model saved as a local .pth file.

Usage pattern

You have to generate a dataloader in pytorch.

trainer = AdversarialTraining(model=your_architecture, optimizer=your_optimizer, loss_func=your_criterion, device=your_device, epsilon=your_epsilon)
trainer.fit(epochs=2, train_dataloader=your_train_dataloader, val_dataloader=your_val_dataloader, patience=2, checkpoint=your_path)

For more informations, you can follow the notebook example here : Notebook

How to run the provided example

  • Download the example dataset here and unzip it in the examples/ folder. Once done, you should have subfolder named /examples/dataset/c00

  • Launch the jupyter notebook examples/training.ipynb