0% found this document useful (0 votes)
434 views

Fastai Library Documentation

The document discusses different modules and functions related to neural networks and deep learning. It includes modules like nn.Module, nn.Sequential, RNN as well as functions for loading data, initializing weights, and tracking progress of computations.

Uploaded by

Qaje Bab
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
434 views

Fastai Library Documentation

The document discusses different modules and functions related to neural networks and deep learning. It includes modules like nn.Module, nn.Sequential, RNN as well as functions for loading data, initializing weights, and tracking progress of computations.

Uploaded by

Qaje Bab
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Sat Nov 11 2017

nn.Module nn.Sequential
io.py nn.Module
tqdm … …
io
fastai torch_imports.py imports.py core.py get_data(url, filename)
models …
utils.py initializers.py RNN
torch_imports.py imports.py core.py
utils.py initializers.py
MixIterator children(m) in_notebook() apply_leaf(m, f)
ceil() apply_init(m, init_fn) tqdm
+ iters save_model(m, p) tqdm(*args, **kwargs) chain_params(p)
copy_layer() cond_init(m, init_fn)
+ multi load_model(m, p) trange(*args, **kwargs) noop(*args, **kwargs) …
copy_layers() load_pre(pre, f, fn) one_hot(a,c) io.py TqdmUpTo
copy_weights() +N
cv2.setNumThreads(0) set_trainable(l, b) wrn_50_2f.py RNN reg
do_clip() + total convert_torch.py
+ __init__() inception_4(pre) set_trainable_attr(m,b) wrn 50 2f convert LM RNN
floor() + reset() inceptionresnet_2(pre) SGD_Momentum(momentum) wrn_50_2f.py wrn_50_2f() inceptionresnetv2.py rnn_reg.py
get_classes() split_by_idxs(seq, idxs)
+ update_to() torch add_submodule(seq, *args)
Inception lm_rnn.py
+ __iter__() structured.py copy_param(m,n) SequentialRNN
gray() inceptionresnetv2(pretrained=True)
+ next() resnext50(pre) sum_geom(a,r,n) lua_recursive_model(module,seq) ResNet v2 LinearRNNOutput LockedDropout
limit_mem() add_datepart(df, fldname, drop=True) inceptionresnetv2.py load() WeightDrop
structured.py apply_cats(df, trn) resnext101(pre) T(a) lua_recursive_source(module) + reset()
load_array() test(model) + initrange
resnext101_64(pre) to_gpu(x, *args, **kwargs) simplify_source(s) +p
plot() combine_date() RNN_Encoder + __init__()
wrn(pre) to_np(v) torch_to_pytorch(t7_filename,outputname=None) + decoder
plots() draw_tree(t, df, size=10, ratio=0.6, precision=0) LambdaBase InceptionResnetV2 BasicConv2d + _setup() + __init__()
trainable_params_(m) + dropout
save_array() fix_missing(df, col, name, na_dict) convert_torch.py + initrange + _setweights() + forward()
dn121(pre) V_(x) torch torch.nn torch.autograd torch.utils itertools ipywidgets + lambda_func + conv2d_1a + conv + encoder
to_plot() get_nn_mappers(df, cat_vars, contin_vars) + __init__() + forward()
dn161(pre) V(x) + conv2d_2a + bn + rnns
wrap_config() get_sample(df,n) dn169(pre) VV_(x) + forward()
+ __init__() + conv2d_2b + relu + dropouti imports only
is_date(x) dn201(pre) VV(x) + forward_prepare() + maxpool_3a rnn_reg.py
numericalize(df, col, name, max_n_cat) + dropouth
LambdaBase + conv2d_3b + __init__()
parallel_trees(m, fn, n_jobs=8) + hidden dropout_mask(x, sz, dropout)
vgg16(pre) + conv2d_4a + forward() rnn_train.py
proc_df() functools math + weights embedded_dropout(embed, words, dropout=0.1, scale=None)
torchvision torchvision.models torchtext + lambda_func + maxpool_5a
reset_rf_samples() + mixed_5b + __init__()
rf_feat_importance(m, df) + __init__() + forward()
+ repeat
scale_vars(df) + forward_prepare() Mixed_6a Mixed_5b Mixed_7a + one_hidden()
set_spawn.py Lambda + mixed_6a
set_plot_sizes(sml, med, big) LambdaReduce LambdaMap + repeat_1 + reset()
set_spawn.py set_rf_samples(n) collections threading + branch0 + branch0 + branch0 nn.Module
+ forward() + mixed_7a
train_cats(df) IPython.lib.deep + forward() + forward() LambdaReduce LambdaMap Lambda + branch1 + branch1 + branch1
from multiprocessing import set_start_method PIL numpy cv2 + repeat_2 …
reload + branch2 + branch2 + branch2
set_start_method('spawn') + forward() + forward() + forward() + block8 + branch3 + branch3
layer optimizer + conv2d_7b + __init__()
nn.Sequential + avgpool_1a + forward() + __init__() + __init__() MultiBatchRNN
layer_optimizer.py json
isoweek + classif + forward() + forward()
… + bs LinearDecoder PoolingLinearClassifier
scipy pandas seaborn matplotlib
+ __init__()
+ __init__() + __init__() + pool()
plots layer_optimizer.py + forward()
LayerOptimizer + concat() + forward() + forward()
opt_params() pandas_summa bcolz + forward()
plots.py set_lrs() + opt Block8 Block17 Block35
ry
+ lrs ResNext 101 resnext_101_64x4d.py resnext_50_32x4d.py
plots.py ResNext 50 + scale + scale + scale
+ __init__() 64x4d resnext_101_64x4d() resnext_50_32x4d()
plots()
resnext_101_64x4d.py 32x4d resnext_50_32x4d.py + noReLU + branch0 + branch0
+ opt_params() + branch0 + branch1 + branch1
plots_from_files() + lr() random
IPython.lib.displ + branch1 + conv2d + branch2
plot_confusion_matrix() + set_lrs() ay + conv2d + relu + conv2d
plots_raw()
AdaptiveConcatPool2d + relu + relu
load_img_id() + __init__()
plot_val_with_title() layers LambdaBase + __init__() + forward() + __init__()
+ ap pickle LambdaBase
most_by_mask() + forward() + forward()
most_by_incorrect() + mp + lambda_func
layers.py + lambda_func
+ __init__() + __init__()
enum.IntEnum + __init__()
+ forward() + forward_prepare()
nn.Module + forward_prepare()
… concurrent.futur
enum
… es sys

Transform Lambda inceptionv4.py


Flatten Lambda
Lambda
Inception
Transforms +f LambdaReduce LambdaMap inceptionv4(pretrained=True)
transforms
+ tfm_y
+ __init__() abc glob string + forward() LambdaReduce LambdaMap v4 inceptionv4.py
+ tfms model + forward() + forward() + forward() load()
transforms.py + __init__() CropType TfmType + forward() + __init__() + forward() + forward() test(model)
model.py + forward()
+ __call__() + __init__()
+ transform_coord() + __call__() + RANDOM + NO InceptionV4
transforms.py + transform() + CENTER + PIXEL
+ NO + COORD model.py Stepper + features BasicModel
imagenet_mean + do_transform() time datetime re SingleModel
+ classif
transforms_basic cut_model() + __init__() BasicConv2d learner + model
+ get_layer_groups()
transforms_side_on predict_to_bcolz() + reset() + __init__() losses.py
learner.py + __init__()
transforms_top_down num_features() + step() + forward() + conv
get_layer_groups() losses.py
Normalize Denormalize set_train_mode() + evaluate() + bn
preprocess_imagenet(x) resnext_101_32x4d.py
+m +m
fit() ResNext 101 + relu fbeta_torch(y_true, y_pred, beta, threshold, eps=1e-9)
preprocess_scale(x) validate() torchvision.models Learner
+s +s 32x4d resnext_101_32x4d()
scale_min(im, targ) get_prediction() resnext_101_32x4d.py + __init__()
Inception_C
zoom_cv(x,z) predict() + forward() clip
+ __init__() + __init__() crit
stretch_cv(x,sr,sc) predict_with_targs() + branch0
+ __call__() + __call__() data_
dihedral(x, dih) model_summary() resnet.py vgg.py + branch1_0 conv_learner.py
lighting(im, b, c) + branch1_1a metrics conv learner
create list of Learner BasicModel Inception_A Inception_B model_meta = {}
rotate_cv(img, deg, mode=cv2.BORDER_REFLECT, Dataset … … + branch1_1b models
network LambdaBase models_path model_features = {}
flags=cv2.INTER_LINEAR) RandomLighting … … resnet18(pretrained=False, **kwargs) vgg16_bn(pretrained=False, **kwargs) + branch0 + branch0 + branch2_0 conv_learner.py
architectures … opt_fn
no_crop(im, min_sz=None) + lambda_func resnet34(pretrained=False, **kwargs) … + branch1 + branch1 + branch2_1
center_crop(im, min_sz=None) + __init__() resnet50(pretrained=False, **kwargs) + branch2 + branch2_2 reg_fn
+ branch2 nn.Module
scale_to(x, ratio, targ) + __call__() + __init__() resnet101(pretrained=False, **kwargs) + branch3 + branch2_3a sched
+ branch3
crop(im, r, c, sz) + forward_prepare() … + branch2_3b … tmp_path metrics.py
det_dihedral(dih) + __init__() + __init__() + branch3 metrics.py
+ forward() + forward() # properties ConvLearner
det_stretch(sr, sc)
RandomLightingXY RandomRotate children() ConvnetBuilder accuracy(preds, targs)
det_lighting(b, c) densenet.py + __init__()
+ forward() model() activations accuracy_multi(preds, targs, thresh)
det_rotate(deg) + __init__() c
+ tfm_y … data() crit accuracy_thresh(thresh)
det_zoom(zoom) + __call__() NLP f
+ b_rand densenet121(pretrained=False, **kwargs) fc_data
rand0(s) nlp.py Lambda __init__() fc_model
+ c_rand densenet161(pretrained=False, **kwargs) metrics
CenterCrop(min_sz=None) LambdaReduce LambdaMap __getitem__(i) is_multi
NoCrop(min_sz=None) RandomRotateXY + forward() densenet169(pretrained=False, **kwargs) Mixed_3a Mixed_4a precompute
+ __init__() RandomRotateZoom Mixed_5a summary() is_reg
Scale(sz) + forward() + forward() densenet201(pretrained=False, **kwargs)
+ set_state() + tfm_y freeze_to(n) # properties lr_cut
RandomFlip() + __init__() … + maxpool + branch0 + maxpool
CoordTransform + do_transform() + rdeg BOW_Dataset BOW_Learner TextModel Reduction_A Reduction_B unfreeze() model() model
channel_dim(x, y) + __call__() + conv + branch1 + conv
+ rp get_model_path(name) data() n_fc
to_bb(YY, y) + transform_coord() nn.Module … … … + branch0 + branch0 nf
+ __init__() + __init__() + __init__() save(name)
coords2px(y, x) + __init__() + forward() + forward() + branch1 + branch1 load(name) __init__() ps
… + forward()
random_px_rect(y, x)
compose(im, y, fns)
+ set_state()
+ transform_coord()
+ branch2 + branch2 set_data(data)
get_cycle_end(name)
3 pretrained(f, data, ps=None, xtra_fc=None, xtra_cut=0, **kwargs)
create_empty_bcolz(n, name)
top_model
xtra_cut
image_gen(normalizer, denorm, sz, tfms=None, + do_transform() + __init__() + __init__() set_data(data) xtra_fc
save_cycle(name, cycle)
max_zoom=None, pad=0, crop_type=None, tfm_y=None) + do_transform_y() ReflectionPad + forward() + forward() get_layer_groups()
load_cycle(name, cycle)
noop(x) DotProdNB LanguageModelData LanguageModelLoader get_activations(force=False) name()
+ __init__() save_fc1()
… … … fit_gen(model, data, layer_opt, n_cycle, cycle_len=None, __init__()
+ add_pad() freeze()
cycle_mult=1, cycle_save_name=None, metrics=None, create_fc_layer(ni, nf, p, actn=None)
+ __call__()
callbacks=None, **kwargs) get_fc_layers()
get_layer_groups(do_fc=False)
get_layer_groups()
get_layer_opt(lrs, wds)
SimpleNB RNN_Learner TextDataLoader 4 fit(lrs, n_cycle, wds=None, **kwargs)
lr_find(start_lr=1e-5, end_lr=10, wds=None)
RandomCropXY
… … … predict(is_test=False)
CenterCropXY NoCropXY + tfm_y RandomDihedralXY RandomFlipXY predict_with_targs(is_test=False)
RandomScaleXY ScaleXY
+ targ TTA(n_aug=4, is_test=False)
+ tfm_y + tfm_y +m + do_flip
+ rand_r + new_sz
+ min_sz + sz +s + tfm_y
+ rand_c + set_state()
+ __init__() + szy
+ __init__() + __init__() + set_state() + do_transform()
+ __init__() + set_state()
+ set_state() + set_state() + do_transform() + __init__() TextClassifierData TextData ConcatTextDataset torchtext.data.Dataset
+ set_state() + do_transform()
+ do_transform() + do_transform() + set_state()
+ do_transform()
RandomDihedral + do_transform() … … … …
RandomScale
RandomCrop
+ __call__()
+ __init__()
+ targ + __call__()
+ __init__()
+ __call__()
ModelData SGDR
# This file contains all the main external libs we'll use
… dataset dataloader.py DataLoader from fastai.imports import *
sgdr.py
numpy_type_map batch_sampler
from fastai.transforms import *
dataloader.py batch_size
from fastai.conv_learner import *
np_collate(batch) collate_fn
from fastai.model import *
get_tensor(batch, pin) dataset
LossRecorder from fastai.dataset import *
drop_last Callback
from fastai.sgdr import *
num_workers
+ on_train_begin() + layer_opt from fastai.plots import *
pin_memory
sampler + on_epoch_end() + init_lrs
+ on_batch_end() + iteration
dataset.py __init__(dataset, batch_size=1, shuffle=False, sampler=None, batch_sampler=None, + epoch
num_workers=0, collate_fn=np_collate, pin_memory=False, drop_last=False)
imagenet_stats __len__() + __init__()
dataset.py inception_stats + on_train_begin()
get_batch(indices)
inception_models __iter__() + on_epoch_end()
+ on_batch_end()
get_cv_idxs(n, cv_idx=4, val_pct=0.2, seed=42) + plot_loss(0
resize_img(fname, targ, path, new_path) LR_Updater + plot_lr()
resize_imgs(fnames, targ, path, new_path)
+ on_train_begin()
read_dir(path, folder)
ModelData BaseDataset + on_batch_end()
read_dirs(path, folder)
+ update_lr()
… n_hot(ids, c) c + calc_lr()
folder_source(path, folder) n
parse_csv_labels(fn, skip_header=True) sz
nhot_labels(label2idx, csv_labels, fnames, c) transform
csv_source(folder, csv_file, skip_header=True, suffix='', continuous=False)
FilesDataset
split_by_idx(idxs, *a) is_multi() LR_Finder
Dataset
1 tfms_from_model(f_model, sz, aug_tfms=[], max_zoom=None, pad=0, crop_type=None, tfm_y=None) fnames is_reg() torch.utils.data.dataset.Dataset
+ lr_mult
column_data path __getitem__(index)
__init__(transform=None) CosAnneal + best
… __getitem__(idx) __len__()
column_data.py __init__(fnames, transform, path)
get_n() __len__() + cycle_iter + __init__()
ModelDataLoader
CollabFilterDataset CollabFilterLearner CollabFilterModel get_sz() get(self, tfm, x, y) + on_train_begin()
dl get_x() get_n() + __init__() + calc_lr()
… … … i resize_imgs(targ, new_path) get_c() + on_train_begin() + on_batch_end()
it FilesArrayDataset denorm(arr) get_sz() + calc_lr() + plot()
get_x()
dataset() y get_y()
BasicModel
__init__(dl) __init__(fnames, y, transform, path)
… ColumnarDataset ColumnarModelData EmbeddingDotBias create_dl(cls, *args, **kwargs) get_y(i)
__iter__() get_c()
… … …
__len__()
__next__()

Learner MixedInputModel StructuredLearner StructuredModel


… … … …
FilesIndexArrayDataset FilesIndexArrayRegressionDataset FilesNhotArrayDataset

get_c() is_reg() is_multi()

ModelData
nn.Module
path
… test_dl
ArraysDataset
trn_dl
val_dl x
y
is_reg()
trn_ds() ImageData
__init__(x, y, transform)
val_ds() get_x(i)
aug_dl
test_ds() get_y(i)
bs
trn_y() get_n()
classes
val_y() get_sz()
fix_dl
__init__(path, trn_dl, val_dl, test_dl=None) num_workers
from_dls(cls, path,trn_dl,val_dl,test_dl=None) path
test_aug_dl
test_dl
trn_dl
val_dl

sz() ArraysIndexDataset ArraysNhotDataset


c()
get_c() is_multi()
__init__(path, datasets, bs, num_workers, classes)
get_c()
get_dl(ds, shuffle)
resized(dl, targ, new_path)
resize(targ, new_path)

ImageClassifierData

is_multi()

get_ds(fn, trn, val, tfms, test=None, **kwargs)


from_arrays(path, trn, val, bs=64, tfms=(None,None), classes=None, num_workers=4, test=None)
2 from_paths(path, bs=64, tfms=(None,None), trn_name='train', val_name='valid', test_name=None, num_workers=8)
from_csv(self, path, folder, csv_fname, bs=64, tfms=(None,None), val_idxs=None, suffix='', test_name=None, continuous=False, skip_header=True, num_workers=8)

You might also like