Exemplo n.º 1
0
)
flags.DEFINE_integer(
    'num_classes', 5,
    'number of classes used in classification (e.g. 5-way classification).')
# oracle means task id is input (only suitable for sinusoid)
flags.DEFINE_string('baseline', None, 'oracle, or None')

## Training options
flags.DEFINE_integer('pretrain_iterations', 0,
                     'number of pre-training iterations.')
flags.DEFINE_integer(
    'metatrain_iterations', 15000,
    'number of metatraining iterations.')  # 15k for omniglot, 50k for sinusoid
flags.DEFINE_integer('meta_batch_size', 25,
                     'number of tasks sampled per meta-update')
flags.DEFINE_float('meta_lr', 0.001, 'the base learning rate of the generator')
flags.DEFINE_integer(
    'update_batch_size', 5,
    'number of examples used for inner gradient update (K for K-shot learning).'
)
flags.DEFINE_float(
    'update_lr', 1e-3,
    'step size alpha for inner gradient update.')  # 0.1 for omniglot
flags.DEFINE_integer('num_updates', 1,
                     'number of inner gradient updates during training.')
flags.DEFINE_integer(
    'sine_seed', '1',
    'seed for the random operations inside sine generator; sinuosidal regression expt'
)

## Model options
Exemplo n.º 2
0
with open(SONG_FN, 'rb') as f:
    filenames = pickle.load(f)


flags.DEFINE_integer('batch', 32, 'Batch size')
flags.DEFINE_integer('epochs', 10, 'Number of iterations to train on the entire dataset')
flags.DEFINE_integer('latent', 100, 'Dimensionality of the latent space')
flags.DEFINE_string('model_path', '.', 'Path to model checkpoint')
flags.DEFINE_string('output_dir', '.', 'Path to model checkpoints and logs')
flags.DEFINE_string('dtype', 'float32', 'Floating point data type of tensorflow graph')
flags.DEFINE_boolean('train', False, 'Train the music GAN')
flags.DEFINE_integer('seed', -1, 'Random seed for data shuffling and latent vector generator')
flags.DEFINE_boolean('logging', False, 'Whether or not to log and checkpoint the training model')
flags.DEFINE_integer('sampling_rate', 14400, 'Sampling rate of loaded music files')
flags.DEFINE_float('g_lr', 1e-4, 'Learning rate of the generator')
flags.DEFINE_float('d_lr', 1e-6, 'Learning rate of the discriminator')
flags.DEFINE_float('dropout', 0.1, 'Dropout rate of the discriminator')
flags.DEFINE_integer('g_attn', 2, 'Number of multi-head attention layers in the generator')
flags.DEFINE_integer('d_attn', 4, 'Number of multi-head attention layers in the disciminator')
flags.DEFINE_float('noise', 0.05, 'Level of noise added to discriminator input data')
flags.DEFINE_integer('heads', 8, 'Number of heads in ALL multi-head attention blocks')
flags.DEFINE_integer('d_model', 768, 'Multi-head attention dimensionality')
flags.DEFINE_boolean('save_data', False, 'Save all training data to a file that will be loaded into memory')


if FLAGS.seed != -1:
    random.seed(FLAGS.seed)
    tf.random.set_seed(FLAGS.seed)

random.shuffle(filenames)
Exemplo n.º 3
0
def define():
    """Define common flags."""
    # yapf: disable
    # common_flags.define() may be called multiple times in unit tests.
    global _common_flags_defined
    if _common_flags_defined:
        return
    _common_flags_defined = True

    flags.DEFINE_integer('batch_size', 32,
                         'Batch size.')

    flags.DEFINE_integer('crop_width', None,
                         'Width of the central crop for images.')

    flags.DEFINE_integer('crop_height', None,
                         'Height of the central crop for images.')

    flags.DEFINE_string('train_log_dir', '/tmp/attention_ocr/train',
                        'Directory where to write event logs.')

    flags.DEFINE_string('dataset_name', 'fsns',
                        'Name of the dataset. Supported: fsns')

    flags.DEFINE_string('split_name', 'train',
                        'Dataset split name to run evaluation for: test,train.')

    flags.DEFINE_string('dataset_dir', None,
                        'Dataset root folder.')

    flags.DEFINE_string('checkpoint', '',
                        'Path for checkpoint to restore weights from.')

    flags.DEFINE_string('master',
                        '',
                        'BNS name of the TensorFlow master to use.')

    # Model hyper parameters
    flags.DEFINE_float('learning_rate', 0.004,
                       'learning rate')

    flags.DEFINE_string('optimizer', 'momentum',
                        'the optimizer to use')

    flags.DEFINE_float('momentum', 0.9,
                       'momentum value for the momentum optimizer if used')

    flags.DEFINE_bool('use_augment_input', True,
                      'If True will use image augmentation')

    # Method hyper parameters
    # conv_tower_fn
    flags.DEFINE_string('final_endpoint', 'Mixed_5d',
                        'Endpoint to cut inception tower')

    # sequence_logit_fn
    flags.DEFINE_bool('use_attention', True,
                      'If True will use the attention mechanism')

    flags.DEFINE_bool('use_autoregression', True,
                      'If True will use autoregression (a feedback link)')

    flags.DEFINE_integer('num_lstm_units', 256,
                         'number of LSTM units for sequence LSTM')

    flags.DEFINE_float('weight_decay', 0.00004,
                       'weight decay for char prediction FC layers')

    flags.DEFINE_float('lstm_state_clip_value', 10.0,
                       'cell state is clipped by this value prior to the cell'
                       ' output activation')

    # 'sequence_loss_fn'
    flags.DEFINE_float('label_smoothing', 0.1,
                       'weight for label smoothing')

    flags.DEFINE_bool('ignore_nulls', True,
                      'ignore null characters for computing the loss')

    flags.DEFINE_bool('average_across_timesteps', False,
                      'divide the returned cost by the total label weight')
Exemplo n.º 4
0
    'as applications h5 file just include weights if true save whole model to h5 file.'
)
flags.DEFINE_bool('use_synth_data', False,
                  'If True then use synth data other than imagenet.')
flags.DEFINE_bool(
    'save_best_only', False,
    'If True then only save a model if `val_loss` has improved..')
flags.DEFINE_integer('train_step', None, 'Train step number')
flags.DEFINE_integer('batch_size', 32, 'Train batch size')
flags.DEFINE_integer('epochs', 200, 'Train epochs')
flags.DEFINE_integer('eval_batch_size', 50, 'Evaluate batch size')
flags.DEFINE_integer('save_every_epoch', 1, 'save every step number')
flags.DEFINE_integer('eval_every_epoch', 1, 'eval every step number')
flags.DEFINE_integer('steps_per_epoch', None, 'steps_per_epoch')
flags.DEFINE_integer('decay_steps', 10000, 'decay_steps')
flags.DEFINE_float('learning_rate', 1e-6, 'learning rate')
flags.DEFINE_bool('createnewmodel', False,
                  'Create a new model from the base Resnet50 model')
# Quantization Config
flags.DEFINE_bool('quantize', False, 'Whether to do quantization.')
flags.DEFINE_string('quantize_output_dir', './quantized/',
                    'Directory for quantize output results.')
flags.DEFINE_bool('quantize_eval', False, 'Whether to do quantize evaluation.')
flags.DEFINE_bool('dump', False, 'Whether to do dump.')
flags.DEFINE_string('dump_output_dir', './quantized/',
                    'Directory for dump output results.')

FLAGS = flags.FLAGS

TRAIN_NUM = NUM_IMAGES['train']
EVAL_NUM = NUM_IMAGES['validation']
Exemplo n.º 5
0
flags.DEFINE_integer('save_summaries_secs', 60,
                     'The frequency with which summaries are saved, in '
                     'seconds.')

flags.DEFINE_integer('save_interval_secs', 600,
                     'Frequency in seconds of saving the model.')

flags.DEFINE_integer('max_number_of_steps', int(1e10),
                     'The maximum number of gradient steps.')

flags.DEFINE_string('checkpoint_inception', '',
                    'Checkpoint to recover inception weights from.')

flags.DEFINE_float('clip_gradient_norm', 2.0,
                   'If greater than 0 then the gradients would be clipped by '
                   'it.')

flags.DEFINE_bool('sync_replicas', False,
                  'If True will synchronize replicas during training.')

flags.DEFINE_integer('replicas_to_aggregate', 1,
                     'The number of gradients updates before updating params.')

flags.DEFINE_integer('total_num_replicas', 1,
                     'Total number of worker replicas.')

flags.DEFINE_integer('startup_delay_steps', 15,
                     'Number of training steps between replicas startup.')

flags.DEFINE_boolean('reset_train_dir', False,
Exemplo n.º 6
0
import split_train_test
import fit_lstm
import evaluate
import SAVE
import make_prediction
from tensorflow.compat.v1 import flags
import pandas as pd
import os

flags.DEFINE_string("path", "./data/catgwise/생활+건강/", "path to data file")
flags.DEFINE_string("click_data", "clicks_ma_ratio", "clicks_minmax, clicks_first_ratio, clicks_ma_ratio")
flags.DEFINE_integer("s", 60, "seasonality")
flags.DEFINE_float("dropout", 0, "dropout rate(default=0)")
flags.DEFINE_integer("epoch", 40, "epoch")
flags.DEFINE_integer("batch_size", 1, "batch size")
flags.DEFINE_integer("pred_time", 30, "how much time to predict")
flags.DEFINE_string("pred_index", "05-01-2020", "when beginning prediction(month-date-year), default:'01-01-2020'")
flags.DEFINE_boolean("bi", True,"true if bidirectional")

FLAGS = flags.FLAGS


catg_lst = os.listdir(FLAGS.path)
#temppollsell=[[True, True, True], [True, True, False], [True, False, True], [True, False, False],
                      #[False, True, True], [False, True, False], [False, False, True], [False,False,False]]
temppollsell=[[True, True, False], [True, False, False],
                      [False, True, False], [False,False,False]]
for category in catg_lst:
    data_path = "{}{}".format(FLAGS.path, category)
    file = pd.read_csv(data_path, encoding='CP949')
    file['date'] = pd.to_datetime(file['date'])