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

add LBFGS optimizer #22

Merged
merged 8 commits into from
Aug 25, 2022
Merged

add LBFGS optimizer #22

merged 8 commits into from
Aug 25, 2022

Conversation

GG-yuki
Copy link

@GG-yuki GG-yuki commented Aug 23, 2022

No description provided.

@GG-yuki GG-yuki closed this Aug 23, 2022
@GG-yuki GG-yuki reopened this Aug 23, 2022
#
# new_opt_confs = []
# for param_group in self.param_groups:
# optimizer_conf = train_conf.optimizer_conf.add()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

无效代码可以去掉

views = []
for p in self.parameters:
if p.grad is None:
view = flow.tensor(np.zeros(p.numel()))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处使用了numpy,可否用oneflow.zeros算子代替

from typing import Callable, Dict, Iterator, List, Tuple, Union
from functools import reduce
from collections import defaultdict, abc as container_abcs
import numpy as np

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不建议框架代码中import numpy

import oneflow as flow
from oneflow.nn.optimizer.optimizer import Optimizer, ParamGroup
from oneflow.nn.parameter import Parameter
import functools

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

与上边from functools import reduce是否有重复

limitations under the License.
"""
import collections
import math

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

math是否有导入的必要

import math
from typing import Callable, Dict, Iterator, List, Tuple, Union
from functools import reduce
from collections import defaultdict, abc as container_abcs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

与上边import collections重复

"""
import collections
import math
from typing import Callable, Dict, Iterator, List, Tuple, Union

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tuple貌似没有用到

@Ikkyu321 Ikkyu321 self-requested a review August 25, 2022 11:19
@Ikkyu321 Ikkyu321 merged commit 5b1f71b into ZJLabDubhe:zj/develop Aug 25, 2022
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

Successfully merging this pull request may close these issues.

2 participants