Add loss, save_inference_model and logger#53
Add loss, save_inference_model and logger#53LielinJiang merged 19 commits intoPaddlePaddle:masterfrom
Conversation
hapi/logger.py
Outdated
| local_rank = ParallelEnv().local_rank | ||
| if local_rank == 0: | ||
| ch = logging.StreamHandler(stream=sys.stdout) | ||
| ch.setLevel(logging.DEBUG) |
There was a problem hiding this comment.
should be set as log_level ? same as below
hapi/loss.py
Outdated
| @@ -0,0 +1,103 @@ | |||
| # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. | |||
hapi/loss.py
Outdated
| __all__ = ['Loss', 'CrossEntropy', 'SoftmaxWithCrossEntropy'] | ||
|
|
||
|
|
||
| def to_list(value): |
There was a problem hiding this comment.
move these common functions to utils.py ?
hapi/test/dist_mnist.py
Outdated
| @@ -0,0 +1,179 @@ | |||
| # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. | |||
There was a problem hiding this comment.
move tests directory to under hapi/ will make whl contains test scripts, do we mean this? OTOH, move tests directory here, tests directory outside should be deleted?
There was a problem hiding this comment.
看了下incubate目录,fleet下也有个test文件夹。把根目录下的tests删除了。到时候挪到框架中,还可以再变一下tests的目录
| from hapi.download import get_weights_path | ||
| from hapi.model import Model | ||
| from hapi.loss import Loss | ||
| from hapi.download import get_weights_path_from_url |
There was a problem hiding this comment.
这个名字有点长,是否从url,可以内部判断吧,可以直接用download吗? 返回weight的path
hapi/model.py
Outdated
| params_filename(str|None): The name of file to save all related parameters. | ||
| If it is set None, parameters will be saved | ||
| in separate files . | ||
| export_for_deployment(bool): If True, programs are modified to only support |
There was a problem hiding this comment.
下面调用fluid.io.save_inference_model时始终传入的 infer_prog,而export_for_deployment=False时描述是为了训练。 这里觉得可以先把export_for_deployment参数去掉
hapi/test/dist_mnist.py
Outdated
| return x | ||
|
|
||
|
|
||
| class MNIST(Model): |
There was a problem hiding this comment.
内部已经封装了LeNet了,觉得可以用,这里就不用写这些了
hapi/logger.py
Outdated
| logger.propagate = False | ||
|
|
||
| format_str = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | ||
| logging.basicConfig(format=format_str, level=log_level) |
There was a problem hiding this comment.
Maybe we'd better not to use logging.basicConfig, it seems make user's logging setting ignored afterwards. See PaddlePaddle/Paddle#17786
hapi/logger.py
Outdated
| from paddle.fluid.dygraph.parallel import ParallelEnv | ||
|
|
||
|
|
||
| @functools.lru_cache() |
There was a problem hiding this comment.
Would there be python version incompatibility for functools.lru_cache
There was a problem hiding this comment.
removed, thanks.
Uh oh!
There was an error while loading. Please reload this page.