<commit_before>'''Simple GAN model

'''

import logging

import torch
from torch import autograd
from torch.autograd import Variable
import torch.nn.functional as fun

from .gan import apply_penalty, f_divergence
from .modules.densenet import DenseNet


logger = logging.getLogger('cortex.models' + __name__)

resnet_discriminator_args_ = dict(dim_h=64, batch_norm=True, f_size=3, n_steps=3)
resnet_generator_args_ = dict(dim_h=64, batch_norm=True, f_size=3, n_steps=3)

mnist_discriminator_args_ = dict(dim_h=64, batch_norm=True, f_size=5, pad=2, stride=2, min_dim=7,
                                 nonlinearity='LeakyReLU')
mnist_generator_args_ = dict(dim_h=64, batch_norm=True, f_size=4, pad=1, stride=2, n_steps=2)

dcgan_discriminator_args_ = dict(dim_h=64, batch_norm=True, n_steps=3, nonlinearity='ReLU')
dcgan_generator_args_ = dict(dim_h=64, batch_norm=True, n_steps=3)

DEFAULTS = dict(
    data=dict(batch_size=dict(train=64, test=640), skip_last_batch=True,
              noise_variables=dict(z=('normal', 128), r=('normal', 1), f=('normal', 1))),
    optimizer=dict(
        optimizer='Adam',
        learning_rate=1e-4,
        clipping=dict(real_discriminator=0.1, fake_discriminator=0.1),
        updates_per_model=dict(discriminator=1, generator=1, real_discriminator=1, fake_discriminator=1, topnet=1)
    ),
    model=dict(model_type='dcgan', dim_d=1, dim_e=1, discriminator_args=None, generator_args=None),
    procedures=dict(measure='proxy_gan', boundary_seek=False, penalty=1.0, meta_penalty=1.0),
    train=dict(
        epochs=200,
        summary_updates=100,
        archive_every=10
    )
)

def setup(model=None, data=None, procedure=None, **kwargs):
    data['noise_variables']['r'] = ('normal', model['dim_d'])
    data['noise_variables']['f'] = ('normal', model['dim_d'])

<commit_msg>removed defauly gp for meta discriminators in vral<commit_after>'''Simple GAN model

'''

import logging

import torch
from torch import autograd
from torch.autograd import Variable
import torch.nn.functional as fun

from .gan import apply_penalty, f_divergence
from .modules.densenet import DenseNet


logger = logging.getLogger('cortex.models' + __name__)

resnet_discriminator_args_ = dict(dim_h=64, batch_norm=True, f_size=3, n_steps=3)
resnet_generator_args_ = dict(dim_h=64, batch_norm=True, f_size=3, n_steps=3)

mnist_discriminator_args_ = dict(dim_h=64, batch_norm=True, f_size=5, pad=2, stride=2, min_dim=7,
                                 nonlinearity='LeakyReLU')
mnist_generator_args_ = dict(dim_h=64, batch_norm=True, f_size=4, pad=1, stride=2, n_steps=2)

dcgan_discriminator_args_ = dict(dim_h=64, batch_norm=True, n_steps=3, nonlinearity='ReLU')
dcgan_generator_args_ = dict(dim_h=64, batch_norm=True, n_steps=3)

DEFAULTS = dict(
    data=dict(batch_size=dict(train=64, test=640), skip_last_batch=True,
              noise_variables=dict(z=('normal', 128), r=('normal', 1), f=('normal', 1))),
    optimizer=dict(
        optimizer='Adam',
        learning_rate=1e-4,
        clipping=dict(real_discriminator=0.1, fake_discriminator=0.1),
        updates_per_model=dict(discriminator=1, generator=1, real_discriminator=1, fake_discriminator=1, topnet=1)
    ),
    model=dict(model_type='dcgan', dim_d=1, dim_e=1, discriminator_args=None, generator_args=None),
    procedures=dict(measure='proxy_gan', boundary_seek=False, penalty=1.0, meta_penalty=0.0),
    train=dict(
        epochs=200,
        summary_updates=100,
        archive_every=10
    )
)

def setup(model=None, data=None, procedure=None, **kwargs):
    data['noise_variables']['r'] = ('normal', model['dim_d'])
    data['noise_variables']['f'] = ('normal', model['dim_d'])


{'fraction_non_alphanumeric': 0.13706826217024748, 'fraction_numerical': 0.03317922219200435, 'mean_word_length': 5.276450511945392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2170885', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1349, 'n_words': 227}