Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

To All Challengers of Machine Learning

This project is for disadvantaged researchers and students.
You're all working incredibly hard.
You're studying mathematics, reading papers, programming, running experiments, writing in LaTeX, facing criticism, and coming back to try again.
These are all great challenges. I respect you.
I was once one of you. I became fascinated by the nature of timbre, which science still does not fully understand, and that fascination eventually led me to machine learning.
Unfortunately, I have yet to become a professional researcher like you.
What I can do, at least, is provide infrastructure that takes some of the burden out of your machine learning workflows.
I only hope that, in some small way, this can be of help to you.

In the future, you will be forced to face many harmful things.
The problems you are working on come with responsibilities just as great.
The software you create may carry the risk of harming civilization and the natural world.
No matter what anyone else says, believe in ethics, and act on them. And please don't forget that there are others who believe in the same principles and are working toward them too.
It is already reassuring to know that you are here.
Hold on.

Toward The MACH MLOps

As a premise, machine learning operations are complex and should be the problem to be solved with microservices. Nevertheless, there are still too many developers working with monolithic architectures today.
Maybe the reason is simple, because the Python ecosystem has been providing too much. Though it can be seen as a form of SOA, the environment is no longer manageable.
The thing we want to do is only to run machine learning. However, the actual requirements are so many that it becomes a hassle, and we are tacitly trying to hide. First of all, we need to face the fact.

Next, machine learning needs heavy resources.
Graphic boards, storage, databases, and other memory or processors, they usually need massive spec.
Then, please recall that RAM and ROM are separated and both are sharing and communicating. Basically, speed and capacity, the relationship becomes trade-off. Today, computer components have not chosen the way that evolves into all-purpose. They always have been becoming specified modules. And they always have tried to communicate each other.
Today's server infrastructure is the same. This is why we have to understand the MACH architecture. We have already become cloud-native engineers.

By the way, what are existing methods?
As typical examples, using Google Colab, getting physical machine, getting virtual machine, or using Amazon SageMaker.
Google Colab has been the best choice of our de facto standard. Is this really the best way that everyone agree with? Certainly, it is free and easy to use via browsers. However, you surely wouldn’t want to code in such a restricted way.
So, people want to rechoose more customisable way, but, the way of getting physical machine is the worst choice for cloud-native engineering. Or rather this is the motivation of starting this project. Disadvantaged challengers wouldn’t want to struggle with the initial costs, would they?
The way to use virtual machine on EC2 or GCE can cut down initial costs. It is good as the minimal method. However, this does not address cost optimisation or operational optimisation. It needs more features. For example, it can be borrowed only on running and terminated immediately, or it is CI/CD.
How about Amazon SageMaker? It provides the ecosystem. Unfortunately, it can be expensive because some resources remain even when computation is not running. Ideally, we want to develop locally and use cloud resources only when computation is running.
Therefore, we need to choose a custom method finally. Honestly, I don't want to do that, either. However, Google Cloud and TiDB Cloud Serverless provide serverless services that we can design architecture by combining. I've already designed the base system, and you only custom it.

MACH MLOps

Abstract Construction

So, this is the architecture of MACH MLOps I propose.
It is based on Google Cloud, and all of its components are serverless services.
Not only that, but this architecture also has the following features.

  1. The component accepting user requests and the component executing machine learning are separeted. Let's call them API and Batch. Also, the API is REST API.
  2. Swagger UI, API, and Batch systems are based on Docker container, and they are deployed via GitHub Actions Workflow and Artifact Registry. So you can develop these systems on your local machine.
  3. When you send request via the REST API, it is processed asynchronously. Machine learning tasks are executed in batches, a process that takes at least several hours. However, the HTTP response acknowledges the request immediately, while the operation proceeds tacitly in the background.
  4. Compute Engine instance for batch processing is created upon request and automatically deleted one processing is complete or raising errors.
  5. The action of sending request of machine learning parameters and the action of executing machine learning are separated. Please refer to the endpoints below. This mechanism relies on message queuing with Pub/Sub.
  6. For about the method of sending parameter, please define parameters you need in HTTP request body as JSON.
  7. If the batch process is already running, any additional requests will be rejected. Parallel execution does not occur. Pub/Sub manages exclusive lock.
  8. The results calculated within the training batch must be transferred to external data stores, because the batch instance will be deleted after the self process has done.

Endpoints

Path Method Request Body Response Status Response Body
/ POST *(You Define) 204 -
/ HEAD - 204 -

Sequence

sequenceDiagram
    participant Swagger as Swagger UI
    participant API
    participant Workflows
    participant Pub/Sub
    participant Batch
    participant GCS as Cloud Storage
    participant mlforge
    participant TiDB
    Swagger->>API: POST /publish
    API->>Workflows: Execute Publisher
    Workflows->>Pub/Sub: Publish Train Parameters
    API->>Swagger: Accepted
    Swagger->>API: POST /train
    API->>Workflows: Excecute Train Batch
    API->>Swagger: Accepted
    Workflows->>Pub/Sub: 
    Pub/Sub->>Workflows: 
    Workflows->>Batch: Create Batch with Train Parameters
    Batch->>GCS: Request Get Dataet
    Batch->>GCS: Response Get Dataet
    Batch->>mlforge: Create Experiment/Run
    mlforge->>TiDB: Create Experiment/Run
    Batch->>mlforge: Plot Metrics
    mlforge->>TiDB: Plot Metrics
    Batch->>GCS: Post other data
    Batch->>Batch: Terminate Self
    
Loading

Usage

You need to clone two repositories at least, mach_mlops_iac, and mach_mlops_app. Please refer to them for more details.

Repository Suppement
mach_mlops_iac Manages Infrastructure
mach_mlops_app Boiler Plate Application
mlforge Machine Learning Metrics Tracker

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors