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

KeyError:'eps' #55

Open
mono0826 opened this issue Feb 27, 2024 · 2 comments
Open

KeyError:'eps' #55

mono0826 opened this issue Feb 27, 2024 · 2 comments

Comments

@mono0826
Copy link

File "/usr/local/lib/python3.8/dist-packages/torch/optim/adagrad.py", line 128, in step
eps=group["eps"],
KeyError: 'eps'

Hello, I got this error when I was running, how can I solve it?

@hu-xue
Copy link

hu-xue commented Mar 21, 2024

hello, I got this too, Have you solve it? Can you share the fix functions with me?
best wishes!

@yutianhe12345
Copy link

优化器的 eps 参数是一个很小的数值,用于防止除零错误和数值不稳定性。在计算梯度下降步骤中,有时候可能会涉及到除以一个很小的数或者对一个很小的数进行开方操作,而这些操作可能导致数值不稳定或者无法进行。为了避免这种情况,eps 参数会被加到分母中,以确保分母不为零。
加载作者的优化器参数时,这个键eps的值缺失,所以我们可以在加载优化器后声明它的值,代码如下:
optimizer.param_groups[0]['eps'] = 1e-8
image

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