Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mercari ML Platform

Mercari ML Platform

More Decks by Hirofumi Nakagawa/中河 宏文

Other Decks in Technology

Transcript

  1. Mercari ML Platform

    View Slide

  2. 自己紹介
    ● Hirofumi Nakagawa(hnakagawa)
    ● 2017年7月入社
    ● 所属はSRE
    ● デバイスドライバ開発からフロントエ
    ンド開発までやる何でも屋
    ● NOT MLエンジニア

    View Slide

  3. Kubernetes
    CLI Image builder
    Cluster
    Pipeline Engine
    Dashboard
    Metrics
    Runner
    Component
    Mercari ML Component
    ML platform architecture

    View Slide

  4. Kubernetes
    CLI Image builder
    Cluster
    Pipeline Engine
    Dashboard
    Metrics
    Runner
    Component
    Mercari ML Component

    View Slide

  5. Container imageを自動でbuild。利用者がDockerfileを
    書く必要は極力無いようにしてある
    Cluster
    Pipeline Engine
    CLI/Image
    builder
    Metrics
    Clusterリソースを管理し、container化されたData
    Pipelineを実行する
    Prometheus使用している。ML modelに関するmetrics
    を取得

    View Slide

  6. Kubernetes
    CLI Image builder
    Cluster
    Pipeline Engine
    Dashboard
    Metrics
    Runner
    Component
    Mercari ML Component

    View Slide

  7. 前処理や分類器をContainer Pipelineで実行できるよう
    にコンポーネント化したもの
    Runner
    ML Component
    Mercari ML
    Component
    Training/Serving環境でcluster環境とlocal環境の差を
    埋める
    データ・ソースやitem分類等、社内利用に特化したコン
    ポーネント

    View Slide

  8. Container Based Pipeline

    View Slide

  9. DataSource
    Image
    Text 
    Preprocessing
    Image
    PV
    Picture 
    Preprocessing
    Image
    PV
    PV
    Estimator
    Image
    全ての出力はPVに保存されキャッ
    シュとしても利用できる

    View Slide

  10. Model Training & Serving Workflow

    View Slide

  11. CI
    Training Cluster
    Job ・・・
    Model
    Repository
    Job
    Job
    Serving Cluster
    REST
    API
    TF
    Serving
    Faiss ・・・
    全てのModelが
    version管理 & image化されている

    View Slide

  12. Serving Architecture

    View Slide

  13. Mercari API
    Flask
    SK
    Model
    SK
    Model
    SK
    Model
    TensorFlow
    Serving
    TF
    Model
    TF
    Model
    TF
    Model
    Virtual
    Service
    Basic serving API architecture

    View Slide

  14. Streaming serving API architecture
    Flask
    SK
    Model
    SK
    Model
    SK
    Model
    TensorFlow
    Serving
    TF
    Model
    TF
    Model
    TF
    Model
    Virtual
    Service
    Proxy

    View Slide

  15. A/B Test Architecture

    View Slide

  16. Model
    Service
    A 
    Virtual
    Service
    Model
    Service
    B 
    Mercari API
    90%
    10%
    Model API is activated by Istio

    View Slide

  17. Common Problems of Model Serving

    View Slide

  18. Huge model file vs container image
    • 巨大なMLモデルファイルをimageに含めるか否か
    • 含めないのであれば何処に配置するのか
    • ポータビリティとロード時間のトレードオフ

    View Slide

  19. Effective memory usage
    • 数GB程度のメモリを使用するのは普通
    • プロセス毎にモデルをロードする必要がある環境は辛い
    • Copy on Write(CoW)を利かす工夫が必要

    View Slide

  20. In Progress

    View Slide

  21. モデル評価と
    ReTrainingの自動化
    モデル生成の
    自動化
    本番環境への自動
    Deploy
    Architecture searchやHyper parameter optimization
    によって簡単なモデル生成を自動化・簡素化
    生成されたモデルを本番環境へ自動Deployし、最も良
    いモデルが自動選択される
    高度な自動化
    運用中のモデルの評価/可視化、Re-Trainingを高度化・
    自動化する

    View Slide

  22. ML Continuous
    Deployment
    Deploy
    Monitoring
    Evaluation
    Hyper
    parameter
    optimization
    Re-Training
    リリース後も
    精度監視・Hyper parameterチューニング・Re-training・Deployを自
    動で行う

    View Slide

  23. AutoFlow
    Feature Extraction
    Components
    Concatenation
    Components
    Classification
    Components
    Model Builder
    Component
    Repository

    View Slide

  24. In Future

    View Slide

  25. Edge
    Device
    Democratization
    of AI
    Further
    Automation
    Future Plans

    View Slide

  26. Edge Device
    • TensorFlow LiteやCore ML等Edgeサイドでpredictionを行える環
    境が整ってきた
    • EdgeでのpredictionはUX上大きなメリットがあると考えている
    • 調査・研究を進めているので今後に乞うご期待?

    View Slide

  27. Democratization of AI
    • 多くのモデルが求められている
    • MLエンジニア以外もモデルを作れるようにする
    • DataPlatformと合せて環境を整備する必要

    View Slide

  28. Further Automation
    • 近い将来、数千〜のモデル運用を行う必要がある
    • さらなる高度な自動化が不可欠

    View Slide

  29. View Slide