Skip to content

2. Creating the Model

kausmik edited this page Aug 25, 2020 · 1 revision

Overview

DashAI allows you to train a model on a certain Databunch.You can either train the default model provided by us or make your own custom models.

Alt Text


Tabular Model:

Default Model:

Default Model for tabular applications.

"default": {
	"out_sz": null,
	"layers": [200, 100],
	"emb_drop": 0,
	"ps": null,
	"y_range": null,
	"use_bn": true,
	"bn_final": false
},

Refer https://docs.fast.ai/tabular.models.html to know more details about the different arguments.

Custom Model:

Custom Model for tabular data.

"custom": {
	"layers": ["nn.Linear(4, 5)", "nn.ReLU()", "nn.Linear(5, 3)"],
	"extra_args": {
		"bn_begin": false
	}
}

DashAI allows you to add different torch.nn layers to your models.Add sufficient layers to make your own custom models for tabular application.


Vision Model:

CNN and UNET Model:

Default Models for vision applications.

CNN Model -

"cnn": {
	"method": "default",
	"default": {
		"arch": "resnet18",
		"extra":{
			"cut": null,
			"pretrained": true,
			"lin_ftrs": [512],
			"ps": 0.5,
			"custom_head": null,
			"split_on": null,
			"bn_final": false,
			"concat_pool": true,
			"init": "nn.init.kaiming_normal_"
		}
	}
},

UNET Model -

"unet": {
	"method": "default",
	"default": {
		"arch": "resnet18",
		"extra":{
			"cut": null,
			"pretrained": true,
			"split_on": null,
			"blur_final": true,
			"norm_type": null,
			"blur": false,
			"self_attention": false,
			"y_range": null,
			"last_cross": true,
			"bottle": false
		}
	}
},

Custom Model:

Custom Model for vision data.

"custom": {
	"layers": ["nn.Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)",
		"nn.ReLU(inplace=True)",
		"nn.Conv2d(64, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)",
		"nn.Flatten()",
		"nn.Linear(in_features=100352, out_features=2, bias=True)"
	],
	"extra": {}
}

DashAI allows you to add different torch.nn layers to your models.Add sufficient layers to make your own custom models for vision application.


Text Model:

"model": {
        "type": "classifier",
	"classifier": {
		"method": "default",
		"lm_train_epochs": 0,
		"default": {
			"arch": "AWD_LSTM",
			"extra": {
				"bptt":70,
				"max_len": 140,
				"pretrained": true,
				"drop_mult": 1.0,
				"lin_ftrs": null,
				"ps": null
			},
			"configs": {
				"AWD_LSTM": {
					"bidir": false,
					"emb_sz": 400,
					"embed_p": 0.02,
					"hidden_p": 0.15,
					"input_p": 0.25,
					"n_hid": 1152,
					"n_layers": 3,
					"output_p": 0.1,
					"pad_token": 1,
					"qrnn": false,
					"weight_p": 0.2
				},
				"Transformer": {
					"ctx_len":512,
					"n_layers":12,
					"n_heads":12,
					"d_model":768,
					"d_head":64,
					"d_inner":3072,
					"resid_p":0.1,
					"attn_p":0.1,
					"ff_p":0.1,
					"embed_p":0.1,
					"output_p":0.0,
					"bias":true,
					"scale":true,
					"act":"Activation.GeLU",
					"double_drop":false,
					"init":"init_transformer",
					"mask":false
				},
				"TransformerXL": {
					"ctx_len":150,
					"n_layers":12,
					"n_heads":10,
					"d_model":410,
					"d_head": 41,
					"d_inner":2100,
					"resid_p":0.1,
					"attn_p":0.1,
					"ff_p":0.1,
					"embed_p":0.1,
					"output_p":0.1,
					"bias":false,
					"scale":true,
					"act":"Activation.ReLU",
					"double_drop":true,
					"init":"init_transformer",
					"mem_len":150,
					"mask":true
				}
			}
		}
	},
	"language_model": {
		"method": "default",
		"default": {
			"arch": "AWD_LSTM",
			"extra": {
				"pretrained": false,
				"drop_mult": 1.0,
				"pretrained_fnames": null
			},
			"configs": {
				"AWD_LSTM": {
					"bidir": false,
					"emb_sz": 400,
					"embed_p": 0.02,
					"hidden_p": 0.15,
					"input_p": 0.25,
					"n_hid": 1152,
					"n_layers": 3,
					"out_bias": true,
					"output_p": 0.1,
					"pad_token": 1,
					"qrnn": false,
					"tie_weights": true,
					"weight_p": 0.2
				},
				"Transformer": {
					"ctx_len":512,
					"n_layers":12,
					"n_heads":12,
					"d_model":768,
					"d_head":64,
					"d_inner":3072,
					"resid_p":0.1,
					"attn_p":0.1,
					"ff_p":0.1,
					"embed_p":0.1,
					"output_p":0.0,
					"bias":true,
					"scale":true,
					"act":"Activation.GeLU",
					"double_drop":false,
					"tie_weights":true,
					"out_bias":false,
					"init":"init_transformer",
					"mask":false
				},
				"TransformerXL": {
					"ctx_len":150,
					"n_layers":12,
					"n_heads":10,
					"d_model":410,
					"d_head": 41,
					"d_inner":2100,
					"resid_p":0.1,
					"attn_p":0.1,
					"ff_p":0.1,
					"embed_p":0.1,
					"output_p":0.1,
					"bias":false,
					"scale":true,
					"act":"Activation.ReLU",
					"double_drop":true,
					"tie_weights":true,
					"out_bias":true,
					"init":"init_transformer",
					"mem_len":150,
					"mask":true
				}
		}
	}
}