bayesflow-memory

Manage GPU memory for BayesFlow training pipelines to prevent CUDA OOM errors.

Updated Mar 5, 2026
One-click install
npx skills add https://github.com/matthiaskloft/claude-skills --skill bayesflow-memory
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bayesflow-memory
Source: https://github.com/matthiaskloft/claude-skills/tree/main/bayesflow/skills/bayesflow-memory
Command: npx skills add https://github.com/matthiaskloft/claude-skills --skill bayesflow-memory

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses critical GPU memory issues, including CUDA Out-of-Memory (OOM) errors and training crashes, by providing strategies to optimize memory usage within BayesFlow training pipelines.

Core Features & Use Cases

  • OOM Detection & Recovery: Automatically detects and recovers from CUDA OOM errors by adjusting batch sizes or employing other memory-saving techniques.
  • Gradient Checkpointing: Trades compute for memory by recomputing activations during the backward pass, significantly reducing peak memory requirements.
  • Memory Probing: Intelligently probes a grid of memory configurations to find the optimal settings before training begins.
  • Use Case: When your BayesFlow training job fails with a CUDA OOM error, this skill can automatically retry with a smaller batch size or enable gradient checkpointing to allow the training to complete successfully.

Quick Start

Use the bayesflow-memory skill to automatically retry training with a halved batch size when an OOM error occurs.

Frequently Asked Questions about bayesflow-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix CUDA out of memory errors during BayesFlow training?

To fix CUDA out of memory errors during BayesFlow training, you can automatically retry the job with a halved batch size or enable gradient checkpointing to reduce peak GPU memory usage.

How does gradient checkpointing reduce GPU memory for PyTorch training?

Gradient checkpointing reduces GPU memory by trading compute for memory, recomputing activations during the backward pass rather than storing them, which significantly lowers peak memory requirements.

What is the best way to find optimal GPU memory settings before training starts?

The best way to find optimal GPU memory settings before training is memory probing, which intelligently tests a grid of memory configurations to identify safe parameters and prevent crashes.

Does gradient checkpointing for BayesFlow require a specific backend?

Yes, gradient checkpointing for BayesFlow requires the PyTorch backend to recompute activations during the backward pass and successfully lower peak GPU memory requirements.

What strategies help prevent OOM errors in GPU memory optimization pipelines?

Strategies to prevent OOM errors include batch-size backoff, gradient checkpointing, memory probing, detached sampling, and chunked log-prob calculations to manage and optimize GPU memory.

Can I estimate GPU memory constraints for hyperparameter optimization?

Yes, you can estimate GPU memory constraints for hyperparameter optimization using analytical memory estimation, ensuring proposed configurations stay within safe HPO memory limits.