NVIDIA-BioNeMo / NVIDIA-BioNeMo/Proteina-Complexa

[Proteina-Complexa] Local finetune crashes: SkipNanGrad incompatible with the fp16 GradScaler

Open
#44 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
432
Forks
78
Avg merge
10d 46m
Merged PRs (30d)
1

Description

Local finetuning crashes with AssertionError: No inf checks were recorded for this optimizer. Precision is chosen by environment, not config: check_cluster() (train.py:45-48) probes SLURM_JOB_ID, so local runs use fp16 (AMP GradScaler) while SLURM uses bf16 (no scaler) — there's no config switch for bf16 locally. The SkipNanGrad callback calls zero_grad() on a NaN gradient, which wipes the scaled grads and breaks the fp16 scaler's scale→unscale→step bookkeeping → the assertion.

Severity: Medium · Status: workaround verified; upstream open

Steps to reproduce
  1. Run python -m proteinfoundation.train --config-name training_local_latents +single=true ... locally (no SLURM_JOB_ID).
  2. On the first NaN-grad step → assertion crash.
  3. Confirmed by toggling: fp16 + skip_nan_grad=True ❌ · fp16 + skip_nan_grad=False ✅ · fp32 ✅.
Fix

Add ++opt.skip_nan_grad=False (keeps mixed precision) or ++force_precision_f32=True. Upstream: make SkipNanGrad scaler-aware (skip when an AMP scaler is active), and/or allow bf16-mixed locally (A100 supports it).

Environment

NVIDIA A100 80GB PCIe · driver 565.57.01 · CUDA 12.7 · repo branch dev @ 916eaae · UV runtime.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with check_cluster() in train.py:45-48 and locate the SkipNanGrad callback involved in local fp16 training. Reproduce with python -m proteinfoundation.train --config-name training_local_latents +single=true and the local configuration, then verify that a scaler-aware fix prevents the assertion while preserving mixed-precision training.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.