Currently, Sedna only supports sklearn's xgboost, Tensorflow, Keras, PyTorch and MindSpore, but doesn’t support MindSpore’s high-level API tool TinyMS.
This proposal aims to implement Senda Python SDK support for TinyMS based on Sedna's lib development interface and implements an Incremental Learning demo.
Taking the case yolo3 incremental learning in Sedna as an example, the user wraps the estimator for the specific model. when the incremental learning interface IncrementalLearning() is called, the following process takes place:
IncrementalLearning instantiates its parent class JobBase.
Call set_backend() in the constructor of JobBase to resolve the framework used by the model to TensorFlow and instantiate the corresponding TFBackend.
TFBackend inherits BackendBase, which is initialized with OS-related configuration when instantiated.
TFBackend implements the specific framework-related configuration.
Sedna parses the underlying framework of the model and runs the model using a different machine learning framework through a backend pair. So we need to :
Improve function set_backend() in sedna/backend/__init__.py
if backend_type == "TINYMS":
from sedna.backend.tinyms import TinyMSBackend as REGISTER
TinyMS is MindSpore's high-level API, but the TinyMS’s methods are not the same as the MindSpore framework’s , so we can not use the idea of inheritance for encapsulation.
TinyMSBackendclass
__init__(self, estimator, fine_tune=True, **kwargs) :initialize
train(self, train_data, valid_data=None, **kwargs): train the model
predict(self, data, **kwargs) : use the model to preidct result
evaluate(self, data, **kwargs): evaluate the accuracy
load_weights(self): load model weight
get_weights(self) :return weight
set_weights(self, weights) :set weight
class TinyMSBackend(MSBackend):
def __init__(self, estimator, fine_tune=True, **kwargs):
...
def train(self, train_data, valid_data=None, **kwargs):
...
def predict(self, data, **kwargs):
...
def evaluate(self, valid_data, **kwargs):
...
def save(self, model_path=None):
...
def load(self, model_url=""):
...
def load_weights(self):
...
def get_weights(self):
...
def set_weights(self, weights):
...
Build an estimator class based on MobileNetV2, encapsulating a series of methods such as train(),evaluate(),predict(), etc.
Call incremental learning API to accomplish model training, evaluation, and inference
Build an estimator class based on MobileNetV2, encapsulating a series of methods such as train(),evaluate(),predict(), etc.
Call incremental learning API to accomplish model training, evaluation and inference
Implementing an incremental learning demo based on MSBackend
TinyMS(08/8-09/16)
Write documentation(09/17-09/30)