You need to sign in or sign up before continuing.
Commit 0a3cc459 authored by Lee's avatar Lee Committed by xuehui
Browse files

Fix some bugs in doc and log (#561)

* fix some bugs in doc and log

* The learning rate focus more on validation sets accuracy than training sets accuracy.
parent 6b8d3852
...@@ -84,7 +84,7 @@ class SendMetrics(keras.callbacks.Callback): ...@@ -84,7 +84,7 @@ class SendMetrics(keras.callbacks.Callback):
Run on end of each epoch Run on end of each epoch
''' '''
LOG.debug(logs) LOG.debug(logs)
nni.report_intermediate_result(logs['acc']) nni.report_intermediate_result(logs["val_acc"])
def train(args, params): def train(args, params):
''' '''
......
...@@ -84,7 +84,7 @@ class SendMetrics(keras.callbacks.Callback): ...@@ -84,7 +84,7 @@ class SendMetrics(keras.callbacks.Callback):
Run on end of each epoch Run on end of each epoch
''' '''
LOG.debug(logs) LOG.debug(logs)
nni.report_intermediate_result(logs['acc']) nni.report_intermediate_result(logs["val_acc"])
def train(args, params): def train(args, params):
''' '''
......
...@@ -40,7 +40,7 @@ logging.basicConfig( ...@@ -40,7 +40,7 @@ logging.basicConfig(
datefmt="%m/%d %I:%M:%S %p", datefmt="%m/%d %I:%M:%S %p",
) )
# set the logger format # set the logger format
logger = logging.getLogger("fashion_mnist-network-morphism-keras") logger = logging.getLogger("FashionMNIST-network-morphism-keras")
# restrict gpu usage background # restrict gpu usage background
...@@ -152,7 +152,7 @@ class SendMetrics(keras.callbacks.Callback): ...@@ -152,7 +152,7 @@ class SendMetrics(keras.callbacks.Callback):
if logs is None: if logs is None:
logs = dict() logs = dict()
logger.debug(logs) logger.debug(logs)
nni.report_intermediate_result(logs["acc"]) nni.report_intermediate_result(logs["val_acc"])
# Training # Training
...@@ -184,7 +184,7 @@ def train_eval(): ...@@ -184,7 +184,7 @@ def train_eval():
# trial report final acc to tuner # trial report final acc to tuner
_, acc = net.evaluate(x_test, y_test) _, acc = net.evaluate(x_test, y_test)
logger.debug("Final result is: %d", acc) logger.debug("Final result is: %.3f", acc)
nni.report_final_result(acc) nni.report_final_result(acc)
......
...@@ -42,7 +42,7 @@ logging.basicConfig( ...@@ -42,7 +42,7 @@ logging.basicConfig(
) )
# pylint: disable=W0603 # pylint: disable=W0603
# set the logger format # set the logger format
logger = logging.getLogger("FashionMNIST-network-morphism") logger = logging.getLogger("FashionMNIST-network-morphism-pytorch")
def get_args(): def get_args():
......
...@@ -152,7 +152,7 @@ class SendMetrics(keras.callbacks.Callback): ...@@ -152,7 +152,7 @@ class SendMetrics(keras.callbacks.Callback):
if logs is None: if logs is None:
logs = dict() logs = dict()
logger.debug(logs) logger.debug(logs)
nni.report_intermediate_result(logs["acc"]) nni.report_intermediate_result(logs["val_acc"])
# Training # Training
...@@ -184,7 +184,7 @@ def train_eval(): ...@@ -184,7 +184,7 @@ def train_eval():
# trial report final acc to tuner # trial report final acc to tuner
_, acc = net.evaluate(x_test, y_test) _, acc = net.evaluate(x_test, y_test)
logger.debug("Final result is: %d", acc) logger.debug("Final result is: %.3f", acc)
nni.report_final_result(acc) nni.report_final_result(acc)
......
...@@ -2,5 +2,5 @@ numpy==1.14.2 ...@@ -2,5 +2,5 @@ numpy==1.14.2
tensorflow==1.12.0 tensorflow==1.12.0
torchvision==0.2.1 torchvision==0.2.1
Keras==2.2.2 Keras==2.2.2
nni==0.3.0 nni==0.4.1
torch==0.4.1 torch==0.4.1
"""Some helper functions for PyTorch, including: # Copyright (c) Microsoft Corporation
- get_mean_and_std: calculate the mean and std value of dataset. # All rights reserved.
- msr_init: net parameter initialization. #
- progress_bar: progress bar mimic xlua.progress. # MIT License
""" #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
# to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import numpy as np import numpy as np
import torch import torch
import torch.nn as nn import torch.nn as nn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment