finetuner.helper module

finetuner.helper.AnyDNN

The type of any implementation of a Deep Neural Network object

alias of TypeVar(‘AnyDNN’)

finetuner.helper.AnyTensor

The type of any implementation of an tensor for model tuning

alias of TypeVar(‘AnyTensor’)

finetuner.helper.AnyDataLoader

The type of any implementation of a data loader

alias of TypeVar(‘AnyDataLoader’)

finetuner.helper.AnyOptimizer

The type of any implementation of an optimizer for training the model

alias of TypeVar(‘AnyOptimizer’)

finetuner.helper.get_framework(dnn_model)[source]

Return the framework that enpowers a DNN model.

Note

This is not a solid implementation. It is based on __module__ name, the key idea is to tell dnn_model without actually importing the framework.

Parameters

dnn_model (~AnyDNN) – a DNN model

Return type

str

Returns

keras, torch, paddle or ValueError

finetuner.helper.is_seq_int(tp)[source]

Return True if the input is a sequence of integers.

Return type

bool