Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大佬,训练loss=nan.0 是什么情况? #17

Open
Chenhuaqi6 opened this issue Jun 8, 2023 · 10 comments
Open

大佬,训练loss=nan.0 是什么情况? #17

Chenhuaqi6 opened this issue Jun 8, 2023 · 10 comments

Comments

@Chenhuaqi6
Copy link

image

@ssbuild
Copy link
Owner

ssbuild commented Jun 8, 2023

image

切换优化器试一下

@Chenhuaqi6
Copy link
Author

图像

切换优化器测试一下

大佬,优化器改用什么最合适呢? 还有 我训练moss-moon-003-sft-int4 的时候显存不够 我把n_layer改成了24 有影响吗?
image

@ssbuild
Copy link
Owner

ssbuild commented Jun 8, 2023

你这个loss 是一开始就是nan吗, 还是训练过程中出现nan , 试一下 adamw

@Chenhuaqi6
Copy link
Author

你这个loss 是一开始就是nan吗, 还是训练过程中出现nan , 试一下 adamw

好的 一开始就是 nan 我试下adamw, 还有这个./zero_to_fp32.py 文件我怎么没找到在哪里

@ssbuild
Copy link
Owner

ssbuild commented Jun 8, 2023

你这个loss 是一开始就是nan吗, 还是训练过程中出现nan , 试一下 adamw

好的 一开始就是 nan 我试下adamw, 还有这个./zero_to_fp32.py 文件我怎么没找到在哪里

lora 不需要转换权重了。 全参数开启deepspeed 才需要。

@Chenhuaqi6
Copy link
Author

我用的ptv2,我看你代码里面 int4模型不支持lora

@Chenhuaqi6
Copy link
Author

你这个loss 是一开始就是nan吗, 还是训练过程中出现nan , 试一下 adamw

好的 一开始就是 nan 我试下adamw, 还有这个./zero_to_fp32.py 文件我怎么没找到在哪里

lora 不需要转换权重了。 全参数开启deepspeed 才需要。
adamw 也是 loss=nan,这个是什么情况? 大佬
image

@ssbuild
Copy link
Owner

ssbuild commented Jun 8, 2023

ptv2 权重 也不用转了, trainer 精度改成 32试试

@Chenhuaqi6
Copy link
Author

好的 我试试

@wangyou0804
Copy link

请问这个问题有解决方案吗,我也遇到了loss为nan的情况,把precision调为32过后报错:
│ /home/user1/.conda/envs/moss/lib/python3.9/site-packages/deep_training/nlp/models/moss/custom_ │
│ autotune.py:93 in run │
│ │
│ 90 │ │ │ │ │ │ │ for config in pruned_configs} │
│ 91 │ │ │ │ bench_end = time.time() │
│ 92 │ │ │ │ self.bench_time = bench_end - bench_start │
│ ❱ 93 │ │ │ │ self.cache[key] = builtins.min(timings, key=timings.get) │
│ 94 │ │ │ │ self.hook(args) │
│ 95 │ │ │ │ self.configs_timings = timings │
│ 96 │ │ │ config = self.cache[key] │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: '<' not supported between instances of 'tuple' and 'float'

我修改的配置文件包括:
main.py:
enable_deepspeed = False
enable_ptv2 = True
enable_lora = False
enable_int8 = False # qlora int8
enable_int4 = False # qlora int4

sft_config_ptv2.py:
'optimizer': 'adamw'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants