示例#1
0
    import generative_playground
except:
    import sys, os, inspect
    my_location = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    sys.path.append('../../..')
    sys.path.append('../../../../../transformer_pytorch')
from generative_playground.molecules.train.vae.main_train_vae import train_vae

from generative_playground.molecules.model_settings import get_settings

molecules = True
grammar = True
settings = get_settings(molecules,grammar)

save_file =settings['filename_stub'] + 'dr0.2_rnn__.h5'

model, fitter, main_dataset = train_vae(molecules=molecules,
                                        BATCH_SIZE=150, # 250 max for p2.xlarge
                                        drop_rate=0.2,
                                        save_file=save_file,
                                        sample_z=False,
                                        encoder_type='rnn',
                                        decoder_type='action',
                                        lr=1e-4,
                                        plot_prefix='rnn do0.2 no_sam 1e-4',
                                        preload_weights=False)

while True:
    next(fitter)

示例#2
0
    import sys, os, inspect
    my_location = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    sys.path.append('../../..')
    sys.path.append('../../../../../transformer_pytorch')

from generative_playground.molecules.train.vae.main_train_vae import train_vae
from generative_playground.molecules.model_settings import get_settings

molecules = True
grammar = True
settings = get_settings(molecules,grammar)

save_file =settings['filename_stub'] + 'baseline__.h5'
model, fitter, _ = train_vae(molecules=molecules,
                             grammar=grammar,
                             BATCH_SIZE=50,  # max 500 on a p2.xlarge
                             save_file=save_file,
                             sample_z=True,
                             encoder_type='cnn',
                             decoder_type='step',
                             lr=5e-4,
                             plot_prefix='baseline lr 5e-4 KLW 0.01',
                             reg_weight= 1,
                             epsilon_std = 0.01,
                             dashboard='main',
                             preload_weights=False)

while True:
    next(fitter)

示例#3
0
    import generative_playground
except:
    import sys, os, inspect
    my_location = os.path.dirname(
        os.path.abspath(inspect.getfile(inspect.currentframe())))
    sys.path.append('../../..')
    sys.path.append('../../../../../transformer_pytorch')
from generative_playground.molecules.train.vae.main_train_vae import train_vae

from generative_playground.molecules.model_settings import get_settings

molecules = True
grammar = True
settings = get_settings(molecules, grammar)

save_file = settings['filename_stub'] + 'dr0.4_rnn_resnet__.h5'

model, fitter, main_dataset = train_vae(
    molecules=molecules,
    BATCH_SIZE=100,  # max 200 on p2.xlarge
    drop_rate=0.2,
    save_file=save_file,
    sample_z=False,
    encoder_type='rnn',
    decoder_type='action_resnet',
    lr=1e-4,
    plot_prefix='rnn_resnet do=0.4 1e-4')

while True:
    next(fitter)
from generative_playground.models.simple_models import DenseHead
import numpy as np
from generative_playground.utils.gpu_utils import to_gpu

molecules = True
grammar = True
settings = get_settings(molecules, grammar)

dash_name = 'test'
visdom = Dashboard(dash_name)
model, fitter, main_dataset = train_vae(molecules=True,
                                        grammar=True,
                                        BATCH_SIZE=150,
                                        drop_rate=0.3,
                                        sample_z=True,
                                        save_file='next_gen.h5',
                                        encoder_type=False,
                                        lr=5e-4,
                                        plot_prefix='RNN enc lr 1e-4',
                                        dashboard=dash_name,
                                        preload_weights=False)
# this is a wrapper for encoding/decodng
grammar_model = ZincGrammarModel(model=model)
validity_model = to_gpu(
    DenseHead(model.encoder, body_out_dim=settings['z_size'], drop_rate=0.3))

valid_smile_ds = IncrementingHDF5Dataset('valid_smiles.h5', valid_frac=0.1)
invalid_smile_ds = IncrementingHDF5Dataset('invalid_smiles.h5', valid_frac=0.1)

valid_fitter = train_validity(grammar=grammar,
                              model=validity_model,
示例#5
0
except:
    import sys, os, inspect
    my_location = os.path.dirname(
        os.path.abspath(inspect.getfile(inspect.currentframe())))
    sys.path.append('../../..')
    sys.path.append('../../../../../transformer_pytorch')
from generative_playground.molecules.train.vae.main_train_vae import train_vae
from generative_playground.molecules.model_settings import get_settings

molecules = True
grammar = True
settings = get_settings(molecules, grammar)

save_file = settings['filename_stub'] + 'dr0.2_attn__.h5'

model, fitter, main_dataset = train_vae(
    molecules=molecules,
    BATCH_SIZE=10,  # it's a bit of a GPU RAM hog
    drop_rate=0.2,
    save_file=save_file,
    sample_z=False,
    reg_weight=1,  # with 0.01 and do 0.1 had real trouble generalizing?
    encoder_type='attention',
    decoder_type='attention',
    lr=1e-4,
    plot_prefix='attn do=0.2 no_sam 1e-4',
    preload_weights=False)

while True:
    next(fitter)