Sign inSign up

getwilds/rtorch

Sponsored OSS

By Fred Hutch Data Science Lab

•Updated 12 months ago

Container image for the use of the Torch R package in FH DaSL's WILDS

Image
Data science
0

10K+

getwilds/rtorch repository overview

⁠rtorch

This directory contains Docker images for R with PyTorch integration, providing a CUDA-enabled environment for deep learning in R.

⁠Available Versions

⁠Image Details

These Docker images are built from NVIDIA's CUDA 11.7.1 with cuDNN 8 base image and include:

  • R 4.1.2: Statistical computing environment
  • torch v0.13.0: R interface to the PyTorch deep learning library
  • CUDA 11.7.1: For GPU acceleration
  • cuDNN 8: Deep Neural Network library
  • Preinstalled R packages for machine learning and data workflows
  • libtorch / PyTorch backends: Installed via torch::install_torch() for the appropriate CUDA runtime inside the image.

The images are designed to provide a comprehensive environment for deep learning in R with GPU acceleration.

⁠Preinstalled R Packages:

Core/Build:

  • remotes: Install specific versions of CRAN/GitHub packages; used at build time to pin torch to 0.13.0.
  • pacman: Convenience package maintainer to install/load packages; helpful in scripts and reproducible containers.

Torch Ecosystem:

  • torch: Tensor operations, autograd, modules, and optimizers for deep learning in R (0.13.0).
  • torchvision: Vision utilities for R torch: common datasets, transforms/augmentations, and model helpers for CV tasks.
  • torchdatasets: Dataset and dataloader tooling for torch; stream data, compose transforms, and build efficient input pipelines.
  • coro: Coroutines used by the torch input pipeline (e.g., iterators).

Data Engineering/Utilities:

  • magick: Image I/O and processing (resize, crop, annotate, format conversion) backed by ImageMagick; useful for computer vision preprocessing.
  • pins: Versioned data artifacts (local folder, S3, GCS, etc.); cache datasets, models, and intermediate results.
  • tidyverse: Data manipulation, visualization, and I/O (e.g., dplyr, ggplot2, readr, tidyr) for end-to-end analysis.

Modeling/Evaluation:

  • smotefamily: Oversampling for imbalanced class learning (SMOTE variants).
  • pROC: ROC curves, AUC, CI, partial AUC, etc.
  • PRROC: Precision-Recall, ROC curves with fast computation.
  • igraph: Network analysis and graph algorithms; useful for graph neural networks and complex network modeling.

⁠Usage

⁠Docker
docker pull getwilds/rtorch:latest
# or
docker pull getwilds/rtorch:0.13.0

# Alternatively, pull from GitHub Container Registry
docker pull ghcr.io/getwilds/rtorch:latest
⁠Singularity/Apptainer
apptainer pull docker://getwilds/rtorch:latest
# or
apptainer pull docker://getwilds/rtorch:0.13.0

# Alternatively, pull from GitHub Container Registry
apptainer pull docker://ghcr.io/getwilds/rtorch:latest
⁠Example Command
# Docker (using a hypothetical script called "train_model.R")
docker run --gpus all --rm -v /path/to/project:/project getwilds/rtorch:latest Rscript /project/train_model.R

# Apptainer
apptainer run --nv --bind /path/to/project:/project docker://getwilds/rtorch:latest Rscript /project/train_model.R

# Apptainer (local SIF file)
apptainer run --nv --bind /path/to/project:/project rtorch_latest.sif Rscript /project/train_model.R

⁠GPU Support

To use GPU acceleration with this image, ensure that:

  1. Your host has NVIDIA drivers installed
  2. You have NVIDIA Container Toolkit⁠ installed
  3. You use the --gpus all flag when running the container

⁠Security Features

The rtorch Docker images include:

  • Automated version detection and pinning for all system dependencies to ensure reproducibility
  • hadolint-compliant Dockerfile structure with optimized layer consolidation
  • CUDA and cuDNN integration for GPU acceleration
  • Minimal installation with only required packages
⁠Security Scanning and CVEs

These images are regularly scanned for vulnerabilities using Docker Scout. However, due to the nature of deep learning frameworks and their dependencies, some Docker images may contain components with known vulnerabilities (CVEs).

Use at your own risk: While we strive to minimize security issues, these images are primarily designed for research and analytical workflows in controlled environments.

For the latest security information about this image, please check the CVEs_*.md files in this directory⁠, which are automatically updated through our GitHub Actions workflow. If a particular vulnerability is of concern, please file an issue⁠ in the GitHub repo citing which CVE you would like to be addressed.

⁠Dockerfile Structure

The Dockerfile follows these main steps:

  1. Uses NVIDIA CUDA 11.7.1 with cuDNN 8 as the base image
  2. Adds metadata labels for documentation and attribution
  3. Sets shell options with pipefail for better error handling
  4. Sets environment variables for non-interactive installation
  5. Installs system dependencies with automated version detection (gfortran, LAPACK/BLAS, graphics libraries, etc.)
  6. Installs R packages in consolidated layers: remotes, torch ecosystem, core data science packages, and tidyverse
  7. Installs PyTorch backends through the R interface

⁠Source Repository

These Dockerfiles are maintained in the WILDS Docker Library⁠ repository.

Tag summary

Content type

Image

Digest

sha256:9db737f83…

Size

6.4 GB

Last updated

about 1 year ago

docker pull getwilds/rtorch