def macro_init(): DEFINE_boolean("reset_output_dir", False, "Delete output_dir if exists.") DEFINE_string("output_dir", "", "") DEFINE_string("search_for", "macro", "Must be [macro|micro]") DEFINE_integer("batch_size", 128, "") DEFINE_integer("num_epochs", 310, "") DEFINE_integer("train_data_size", 45000, "") DEFINE_integer("child_num_layers", 12, "") DEFINE_integer("child_num_branches", 6, "") DEFINE_integer("child_out_filters", 36, "") DEFINE_integer("child_num_cells", 5, "") DEFINE_float("controller_lr", 0.001, "") DEFINE_float("controller_lr_dec_rate", 1.0, "") DEFINE_float("controller_keep_prob", 0.5, "") DEFINE_float("controller_l2_reg", 0.0, "") DEFINE_float("controller_bl_dec", 0.99, "") DEFINE_float("controller_tanh_constant", 1.5, "") DEFINE_float("controller_op_tanh_reduce", 2.5, "") DEFINE_float("controller_entropy_weight", 0.0001, "") DEFINE_float("controller_skip_target", 0.4, "") DEFINE_float("controller_skip_weight", 0.8, "") DEFINE_float("controller_temperature", None, "") DEFINE_integer("controller_num_aggregate", 20, "") DEFINE_integer("controller_num_replicas", 1, "") DEFINE_integer("controller_train_steps", 50, "") DEFINE_integer("controller_forwards_limit", 2, "") DEFINE_integer("controller_train_every", 1, "train the controller after this number of epochs") DEFINE_boolean("controller_search_whole_channels", True, "") DEFINE_boolean("controller_sync_replicas", False, "To sync or not to sync.") DEFINE_boolean("controller_training", True, "") DEFINE_boolean("controller_use_critic", False, "") DEFINE_integer("log_every", 50, "How many steps to log") DEFINE_integer("eval_every_epochs", 1, "How many epochs to eval") DEFINE_string("tuner_class_name", "", "") DEFINE_string("tuner_class_filename", "", "") DEFINE_string("tuner_args", "", "") DEFINE_string("tuner_directory", "", "") DEFINE_string("assessor_class_name", "", "") DEFINE_string("assessor_args", "", "") DEFINE_string("assessor_directory", "", "") DEFINE_string("assessor_class_filename", "", "") DEFINE_boolean("multi_phase", True, "") DEFINE_boolean("multi_thread", True, "")
from src.cifar10.data_utils import read_data, read_data_corrupt_label from src.cifar10.general_controller import GeneralController from src.cifar10.general_child import GeneralChild from src.cifar10.micro_controller import MicroController from src.cifar10.micro_child import MicroChild deviceIDs = GPUtil.getFirstAvailable() print('Available GPU: {}'.format(deviceIDs)) os.environ["CUDA_VISIBLE_DEVICES"] = ','.join(map(str, deviceIDs)) flags = tf.app.flags FLAGS = flags.FLAGS DEFINE_boolean("reset_output_dir", False, "Delete output_dir if exists.") DEFINE_string("data_path", "", "") DEFINE_string("output_dir", "", "") DEFINE_string("data_format", "NHWC", "'NHWC' or 'NCWH'") DEFINE_string("search_for", None, "Must be [macro|micro]") DEFINE_integer("batch_size", 32, "") DEFINE_integer("num_epochs", 300, "") DEFINE_integer("child_lr_dec_every", 100, "") DEFINE_integer("child_num_layers", 5, "") DEFINE_integer("child_num_cells", 5, "") DEFINE_integer("child_filter_size", 5, "") DEFINE_integer("child_out_filters", 48, "") DEFINE_integer("child_out_filters_scale", 1, "") DEFINE_integer("child_num_branches", 4, "")
from src.utils import DEFINE_boolean from src.utils import DEFINE_float from src.utils import DEFINE_integer from src.utils import DEFINE_string from src.utils import count_model_params from src.utils import print_user_flags from src.data_utils import read_data from src.models import Hparams from src.models import softmax_classifier,feed_forward_net,conv_net flags = tf.app.flags FLAGS = flags.FLAGS DEFINE_boolean("reset_output_dir", False, "Delete output_dir if exists.") DEFINE_string("data_path", None, "Path to CIFAR-10 data") DEFINE_string("output_dir", "output", "Path to log folder") DEFINE_string("model_name", "", "Name of the method. [softmax|feed_forward|conv]") DEFINE_integer("log_every", 10, "How many steps to log") def get_ops(images, labels): """Builds the model.""" print("-" * 80) print("Creating a '{0}' model".format(FLAGS.model_name)) if FLAGS.model_name == "softmax": ops = softmax_classifier(images, labels)
from src import utils from src.utils import Logger from src.utils import DEFINE_boolean from src.utils import DEFINE_float from src.utils import DEFINE_integer from src.utils import DEFINE_string from src.utils import print_user_flags from src.ptb.ptb_enas_child import PTBEnasChild from src.ptb.ptb_enas_controller import PTBEnasController flags = tf.app.flags FLAGS = flags.FLAGS DEFINE_boolean("reset_output_dir", False, "Delete output_dir if exists.") DEFINE_string("data_path", "", "") DEFINE_string("output_dir", "", "") DEFINE_string("search_for", None, "[rhn|base|enas]") DEFINE_string("child_fixed_arc", None, "") DEFINE_integer("batch_size", 25, "") DEFINE_integer("child_base_number", 4, "") DEFINE_integer("child_num_layers", 2, "") DEFINE_integer("child_bptt_steps", 20, "") DEFINE_integer("child_lstm_hidden_size", 200, "") DEFINE_float("child_lstm_e_keep", 1.0, "") DEFINE_float("child_lstm_x_keep", 1.0, "") DEFINE_float("child_lstm_h_keep", 1.0, "") DEFINE_float("child_lstm_o_keep", 1.0, "") DEFINE_boolean("child_lstm_l_skip", False, "")
from src.DIV2K.data_utils import threaded_input_word_pipeline from src.DIV2K.data_utils import make_eval_batch from src.DIV2K.data_utils import get_random_batch from src.DIV2K.controller import ControllerNetwork from src.DIV2K.controller_inference import ControllerInferenceNetwork from src.DIV2K.child_network import ChildNetwork os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID' os.environ['CUDA_VISIBLE_DEVICES'] = '0' flags = tf.app.flags FLAGS = flags.FLAGS # parameters for result, in/out data DEFINE_boolean("reset_output_dir", True, "Delete output_dir if exists.") DEFINE_string("data_path", "../tfrecord/", "path of train,valid tfrecord folder") DEFINE_string("img_path", "../data/", "path of test image folder") DEFINE_string("data_format", "NHWC", "image data format. 'NHWC' or 'NCHW'") DEFINE_string("output_dir", "./outputs/fixed_small_cb_x4", "path of result") DEFINE_string("checkpoint", "model.ckpt-931000", "path of checkpoint file") DEFINE_string("checkpoint_dir", "./outputs/x2", "path of checkpoint file") DEFINE_boolean("test_mode", False, "use when test") DEFINE_boolean("inference_mode", False, "use when inference") DEFINE_string("use_model", None, "which model to use for training") DEFINE_boolean("rl_search", False, "use global/local feature fusion searching") DEFINE_boolean("cb_reward", True, "use complexity based reward") DEFINE_float("cb_rate", 2, "rate of complexity based reward")
import tensorflow as tf from src.utils import DEFINE_boolean from src.utils import DEFINE_float from src.utils import DEFINE_integer from src.utils import DEFINE_string flags = tf.app.flags FLAGS = flags.FLAGS DEFINE_boolean("reset_output_dir", False, "Delete output_dir if exists.") DEFINE_string("data_path", "", "") DEFINE_string("output_dir", "", "") DEFINE_string("data_format", "NHWC", "'NHWC' or 'NCWH'") DEFINE_string("search_for", None, "Must be [macro|micro]") DEFINE_integer("train_data_size", 45000, "") DEFINE_integer("batch_size", 32, "") DEFINE_integer("num_epochs", 300, "") DEFINE_integer("child_lr_dec_every", 100, "") DEFINE_integer("child_num_layers", 5, "") DEFINE_integer("child_num_cells", 5, "") DEFINE_integer("child_filter_size", 5, "") DEFINE_integer("child_out_filters", 48, "") DEFINE_integer("child_out_filters_scale", 1, "") DEFINE_integer("child_num_branches", 4, "") DEFINE_integer("child_num_aggregate", None, "") DEFINE_integer("child_num_replicas", 1, "") DEFINE_integer("child_block_size", 3, "") DEFINE_integer("child_lr_T_0", None, "for lr schedule") DEFINE_integer("child_lr_T_mul", None, "for lr schedule") DEFINE_integer("child_cutout_size", None, "CutOut size")
import tensorflow as tf from src.utils import DEFINE_boolean from src.utils import DEFINE_float from src.utils import DEFINE_integer from src.utils import DEFINE_string flags = tf.app.flags FLAGS = flags.FLAGS DEFINE_boolean("reset_output_dir", False, "Delete output_dir if exists.") DEFINE_string("output_dir", "", "") DEFINE_string("search_for", "macro", "Must be [macro|micro]") DEFINE_integer("batch_size", 128, "") DEFINE_integer("num_epochs", 310, "") DEFINE_integer("train_data_size", 45000, "") DEFINE_integer("child_num_layers", 12, "") DEFINE_integer("child_num_branches", 6, "") DEFINE_integer("child_out_filters", 36, "") DEFINE_integer("child_num_cells", 5, "") DEFINE_float("controller_lr", 0.001, "") DEFINE_float("controller_lr_dec_rate", 1.0, "") DEFINE_float("controller_keep_prob", 0.5, "") DEFINE_float("controller_l2_reg", 0.0, "") DEFINE_float("controller_bl_dec", 0.99, "") DEFINE_float("controller_tanh_constant", 1.5, "") DEFINE_float("controller_op_tanh_reduce", 2.5, "") DEFINE_float("controller_entropy_weight", 0.0001, "") DEFINE_float("controller_skip_target", 0.4, "")