verl icon indicating copy to clipboard operation
verl copied to clipboard

critic optmizer warning grad_norm is not finite when trained with FSDP multi-node

Open XiaohanZhangCMU opened this issue 1 year ago • 11 comments

when I run run_deepseek7b_llm.sh on single node, everything seems to be fine.

I changed the trainer.nnodes=1 \ to trainer.nnodes=2 and leave everything else the same, then i got a lot of

(WorkerDict pid=9092) WARN: grad_norm is not finite: nan
(WorkerDict pid=9209) WARN: grad_norm is not finite: nan
(WorkerDict pid=9205) WARN: grad_norm is not finite: nan
(WorkerDict pid=9206) WARN: grad_norm is not finite: nan
(WorkerDict pid=9204) WARN: grad_norm is not finite: nan
(WorkerDict pid=9210) WARN: grad_norm is not finite: nan
(WorkerDict pid=9207) WARN: grad_norm is not finite: nan
(WorkerDict pid=9208) WARN: grad_norm is not finite: nan

from the critic optimizer.

The other metrics are looking normal, but wonder why grad_norm for critic would become nan. A similar issue was reported with transformers before but it should have been resolved with transformers>=4.47. So I guess this is something else.

XiaohanZhangCMU avatar Apr 01 '25 21:04 XiaohanZhangCMU

Hi I also had this issue, do you know the cause yet?

Django-Jiang avatar Apr 04 '25 06:04 Django-Jiang

+1 anyone can solve it?

Iron-Boyy avatar Apr 07 '25 08:04 Iron-Boyy

me2, grad_norm for critic is nan

labixiaoK avatar Apr 16 '25 03:04 labixiaoK

my transformers version: 4.51.2, but had this issue too....

qiangqiang1808 avatar Apr 20 '25 05:04 qiangqiang1808

I am facing the same issue as well

ahnesi avatar Apr 21 '25 06:04 ahnesi

self.model: PreTrainedModel = AutoModelForCausalLM.from_pretrained( local_model_path, config=config, torch_dtype=torch.float32, #torch_dtype=torch.bfloat16 if self.config.fp16 else torch.float16, attn_implementation="flash_attention_2", trust_remote_code=trust_remote_code, )

i encounterec this issue when setting bfloat16, i change torch_dtype=torch.float32, and it didnt occur

BinceQu avatar Apr 27 '25 05:04 BinceQu

Similar issue +1, any update on how this is solved? @XiaohanZhangCMU

lynnliu030 avatar May 03 '25 08:05 lynnliu030

same issue. verl has a big bug for sft.

TongLiu-github avatar May 04 '25 16:05 TongLiu-github

same issue

FangdongWang avatar Nov 06 '25 03:11 FangdongWang

Hey guys, try other frameworks for SFT; I think the team did not have the bandwidth to diagnose the issue : (

Django-Jiang avatar Nov 06 '25 08:11 Django-Jiang

定时清理检查结果:这个 issue 最近一次由当前运行账号以外账号产生的公开回复或公开引用是 2025-11-06T08:12:21Z。本轮检查日期为 2026-07-04,该时间已经超过 6 个月。检查来源包括 issue comments API https://api.github.com/repos/verl-project/verl/issues/870/comments?per_page=100 和 timeline API https://api.github.com/repos/verl-project/verl/issues/870/timeline?per_page=100。

按照本仓库的定时 issue 清理标准,我会先留下这条说明并关闭该 issue。若作者或社区成员仍能提供新的复现、证据或需求背景,请继续评论请求重开,或创建新的 issue 并引用这里的上下文。


Scheduled cleanup check: the latest public reply or public reference from an account other than the current automation account was 2025-11-06T08:12:21Z. The check date for this run is 2026-07-04, so that activity is more than 6 months old. The checked public sources were the issue comments API https://api.github.com/repos/verl-project/verl/issues/870/comments?per_page=100 and the timeline API https://api.github.com/repos/verl-project/verl/issues/870/timeline?per_page=100.

Following the scheduled issue cleanup policy, I am leaving this note first and then closing the issue. If the author or community can still provide a fresh reproduction, evidence, or requirement context, please comment to request reopening or open a new issue that links back to this one.

This response was generated by a scheduled Codex GPT5.5 issue processing task.

Kirrito-k423 avatar Jul 04 '26 01:07 Kirrito-k423