How to use the batchflow.models.torch.TorchModel.default_config function in batchflow

To help you get started, we’ve selected a few batchflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github analysiscenter / batchflow / batchflow / models / torch / vgg.py View on Github external
def default_config(cls):
        config = TorchModel.default_config()
        config['common/conv/bias'] = False
        config['body/block'] = dict(layout='cna', pool_size=2, pool_strides=2)
        config['head'] += dict(layout='Vdf', dropout_rate=.8, units=2)

        config['loss'] = 'ce'

        return config
github analysiscenter / batchflow / batchflow / models / torch / resnet.py View on Github external
def default_config(cls):
        config = TorchModel.default_config()
        config['common/conv/bias'] = False
        config['initial_block'] = dict(layout='cnap', filters=64, kernel_size=7, strides=2,
                                       pool_size=3, pool_strides=2)

        config['body/block'] = dict(layout=None, post_activation=None, downsample=False,
                                    bottleneck=False, bottleneck_factor=4,
                                    width_factor=1, zero_pad=False,
                                    resnext=False, resnext_factor=32)

        config['head'] = dict(layout='Vdf', dropout_rate=.4)

        config['loss'] = 'ce'

        return config
github analysiscenter / batchflow / batchflow / models / torch / encoder_decoder.py View on Github external
    @classmethod
    def default_config(cls):
        config = TorchModel.default_config()
        config['body/encoder'] = dict(base_class=ResNet18)
        config['body/decoder'] = dict(layout='tna', factor=8, num_stages=3)
        config['body/embedding'] = dict(layout='cna', filters=8)
        config['loss'] = 'mse'
        return config
github analysiscenter / batchflow / batchflow / models / torch / vnet.py View on Github external
def default_config(cls):
        config = TorchModel.default_config()

        filters = 16   # number of filters in the first block
        config['body/layout'] = ['cna', 'cna'*2] + ['cna'*3] * 3
        num_blocks = len(config['body/layout'])
        config['body/filters'] = (2 ** np.arange(num_blocks) * filters).tolist()
        config['body/kernel_size'] = 5
        config['body/upsample'] = dict(layout='tna', factor=2)
        config['head'] = dict(layout='c', kernel_size=1)

        config['loss'] = 'ce'
        if is_best_practice('optimizer'):
            config['optimizer'] = 'Adam'
        else:
            config['optimizer'] = ('SGD', dict(lr=1e-4, momentum=.99))
        return config
github analysiscenter / batchflow / batchflow / models / torch / vgg.py View on Github external
def default_config(cls):
        config = TorchModel.default_config()
        config['common/conv/bias'] = False
        config['body/block'] = dict(layout='cna', pool_size=2, pool_strides=2)
        if is_best_practice():
            config['head'] = dict(layout='Vdf', dropout_rate=.8, units=2)
        else:
            config['head'] = dict(layout='dfa dfa f', units=[4096, 4096, 2], dropout_rate=.8)

        config['loss'] = 'ce'
        #config['decay'] = ('const', dict(boundaries=[92500, 185000, 277500], values=[1e-2, 1e-3, 1e-4, 1e-5]))
        config['optimizer'] = ('SGD', dict(momentum=.9, lr=.01))
        return config