Skip to content

Commit f1f19a0

Browse files
committed
apply lukas suggested improvements
1 parent 24edb75 commit f1f19a0

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

paper/.renvignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
data/**

paper/README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Reproducing the Results
22

3+
Note that there is also a brief section on reproducibility in the appendix of the paper, which includes a description of the hardware.
4+
35
## Computational Environment
46

57
In order to reproduce the results, you can either use the provided docker images or recreate the `renv` environment that is described in `paper/renv.lock`.
@@ -9,6 +11,12 @@ To work with the renv environment, go into the `paper` directory, which will boo
911
renv::restore()
1012
```
1113

14+
Afterwards, you need to install torch:
15+
16+
```{r}
17+
torch::install_torch()
18+
```
19+
1220
We are providing two docker images, one for CPU and one for CUDA GPU that have the same packages from the `renv.lock` file installed.
1321
The images can be downloaded from Zenodo: https://doi.org/10.5281/zenodo.17130368.
1422
You can, for example, use the [zenodo_client](https://pypi.org/project/zenodo-client/) library to download the images:
@@ -26,13 +34,13 @@ https://hub.docker.com/repository/docker/sebffischer/mlr3torch-jss/general
2634

2735
The `Dockerfile`s used to create the images are available in the `./paper/envs` directory.
2836

29-
After downloading the images, you can load them into Docker, e.g. via:
37+
If you have downloaded the images like shown above, you can load them into Docker, e.g. via the command below (or otherwise adjust the path accordingly).
3038

3139
```bash
32-
docker load -i IMAGE_CPU.tar.gz
40+
docker load -i ~/.data/zenodo/17130368/v1/IMAGE_CPU.tar.gz
3341
```
3442

35-
To start the container using `Docker`, run:
43+
To start the CPU docker container, run:
3644

3745
```bash
3846
# from anywhere on your machine
@@ -41,21 +49,31 @@ docker run -it --rm -v <parent-dir-to-paper>:/mnt/data/ sebffischer/mlr3torch-js
4149
cd /mnt/data/paper
4250
```
4351

52+
The CUDA image can be started with the command below, which requires the [nvidia extension](https://docs.nvidia.com/ai-enterprise/deployment/vmware/latest/docker.html).
53+
54+
```bash
55+
docker run -it --gpus all --rm -v ../:/mnt/data sebffischer/mlr3torch-jss:gpu
56+
cd /mnt/data/paper
57+
```
58+
4459
Note that the `.Rprofile` file ensures that when running R programs from the `paper` directory, the renv environment will be used unless the code is run in the docker container, where we are not relying on renv directly.
4560

4661
## Running the Benchmark
4762

48-
Note that while the benchmark uses `batchtools` for experiment definition, we don't use it for job submission in order to ensure that all GPU and CPU benchmarks respectively are run on the same machine.
63+
While the benchmark uses `batchtools` for experiment definition, we don't use it for job submission in order to ensure that all GPU and CPU benchmarks respectively are run on the same machine.
4964
For running the benchmarks, we strongly recommend using the docker images, because we need both PyTorch and (R-)torch, which can be somewhat tricky to setup, especially when using CUDA.
5065

51-
If you want to run it without the docker image, you need to ajust the `PYTHON_PATH` variable in the benchmarking scripts to the path to your Python installation, ensure that `pytorch` is installed and the `"pytorch"` algorithm in `paper/benchmark/benchmark.R` initializes the correct python environment.
66+
If you want to run it without the docker image, you need to adjust the `PYTHON_PATH` variable in the benchmarking scripts to the path to your Python installation, ensure that `pytorch` is installed and the `"pytorch"` algorithm in `paper/benchmark/benchmark.R` initializes the correct python environment.
5267
But again, we strongly recommend using the provided docker images for the benchmarks.
5368

5469
You can still reproduce the results that compare (R) `torch` with `mlr3torch` without the python environment.
5570
To do so, you can subset the experiments that are run to not include the `"pytorch"` algorithm.
5671
This has to be done in the benchmarking scripts, e.g. `paper/benchmark/linux-gpu.R`.
5772
We show further down how to run only a subset of the jobs.
5873

74+
Note that the CUDA benchmarks were run on a machine with 80 GB VRAM, so errors are expected if you have less.
75+
To address this, you can filter the jobs to restrict the number of layers or latent dimensions as shown further down.
76+
5977
### Running the Benchmarks
6078

6179
Note that the benchmarks take quite some time, which was required to ensure results with high precision that cover many different configurations.
@@ -114,21 +132,9 @@ For the main benchmark shown in the paper, run the following command from the `p
114132

115133
```r
116134
Rscript benchmark/plot_benchmark.R
117-
```
118-
119-
For the comparison of "ignite" with standard optimizers, run:
120-
121-
```r
122135
Rscript benchmark/plot_optimizer.R
123136
```
124137

125-
These commands generate the files:
126-
127-
* `paper/benchmark/plot_benchmark.png`
128-
* `paper/benchmark/plot_benchmark_relative.png`
129-
* `paper/benchmark/plot_optimizer.png`
130-
* `paper/benchmark/plot_optimizer_relative.png`
131-
132138
## Recreating the Paper Code
133139

134140
The file `paper/paper_code.R` contains the code from the paper.

0 commit comments

Comments
 (0)