Exemple #1
0
# specify generator
generator_sequence_filename = args.model_dir + "/generator.json"

if os.path.isfile(generator_sequence_filename):
    print "loading", generator_sequence_filename
    with open(generator_sequence_filename, "r") as f:
        try:
            generator_params = json.load(f)
        except:
            raise Exception(
                "could not load {}".format(generator_sequence_filename))
else:
    config = GeneratorParams()
    config.ndim_input = 256
    config.ndim_output = 2
    config.num_mixture = args.num_mixture
    config.distribution_output = "universal"
    config.use_weightnorm = False
    config.weight_std = 0.01
    config.weight_initializer = "Normal"
    config.nonlinearity = "relu"
    config.optimizer = "adam"
    config.learning_rate = 0.0001
    config.momentum = 0.5
    config.gradient_clipping = 1
    config.weight_decay = 0

    # generator
    generator = Sequential()
    generator.add(
Exemple #2
0
# specify generator
generator_sequence_filename = args.model_dir + "/generator.json"

if os.path.isfile(generator_sequence_filename):
    print "loading", generator_sequence_filename
    with open(generator_sequence_filename, "r") as f:
        try:
            params = json.load(f)
        except:
            raise Exception(
                "could not load {}".format(generator_sequence_filename))
else:
    config = GeneratorParams()
    config.ndim_input = ndim_latent_code
    config.ndim_output = image_width * image_height
    config.distribution_output = "tanh"
    config.use_weightnorm = False
    config.weight_init_std = 0.1
    config.weight_initializer = "Normal"
    config.nonlinearity = "relu"
    config.optimizer = "adam"
    config.learning_rate = 0.0001
    config.momentum = 0.5
    config.gradient_clipping = 10
    config.weight_decay = 0

    # generator
    generator = Sequential(weight_initializer=config.weight_initializer,
                           weight_init_std=config.weight_init_std)
    generator.add(