๐Ÿš€ What is MLOps?

MLOps๋Š” DevOps์˜ ๋ชฉํ‘œ์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์‚ฌ์šฉ์ž์—๊ฒŒ ์„œ๋น„์Šค๋ฅผ ๋น ๋ฅด๊ฒŒ ์ „๋‹ฌํ•˜๋Š” ๊ฐœ๋ฐœ ๋ฌธํ™”์ž…๋‹ˆ๋‹ค. DevOps์—์„œ๋Š” โ€œ์ฝ”๋“œ ํ†ตํ•ฉ, ํ…Œ์ŠคํŠธ, ๋ฐฐํฌ, ํ…Œ์ŠคํŠธ, ๋ชจ๋‹ˆํ„ฐ๋งโ€ ์˜ ํŒŒ์ดํ”„๋ผ์ธ์„ ์ž๋™ํ™”ํ•˜์—ฌ ์ด ๋ชฉํ‘œ๋ฅผ ๋‹ฌ์„ฑํ•ฉ๋‹ˆ๋‹ค. MLOps๋Š” DevOps์— ML์ด ์ถ”๊ฐ€๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๐Ÿ”” Purpose

  • ๋จธ์‹ ๋Ÿฌ๋‹์˜ ํ•™์Šต, ๋ฐฐํฌ, ์ €์žฅ ์ž๋™ํ™” ๋ผ์ธ ๊ตฌํ˜„.
  • ๋ฐ์ดํ„ฐ ์‚ฌ์ด์–ธํ‹ฐ์ŠคํŠธ์™€ ์†Œํ”„ํŠธ์›จ์–ด ์—”์ง€๋‹ˆ์–ด์—๊ฒŒ ํ˜‘์—… ํ™˜๊ฒฝ์„ ์ œ๊ณต

๐Ÿ’พ Data

  • Income Dataset
  • Perform Binary Classification to predict if Salary is greater than $50K

Phase 0 (2022.05.01 - 2022.05.22)

Ubuntu Python3.9.7 Postgres FastAPI Redis Docker

0. ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ธํŒ…

  • git-flow : github flow ์ฑ„ํƒ
  • github์—์„œ ์‚ฌ์šฉํ•  issue์™€ pr ํ…œํ”Œ๋ฆฟ ์ƒ์„ฑ
  • pre-commit์„ ํ†ตํ•œ code ์Šคํƒ€์ผ ํ†ต์ผ
  • python 3.9.7
  • gcp๋ฅผ ํ†ตํ•ด์„œ unbuntu20.04 ์„œ๋ฒ„์ƒ์„ฑ(ssh์ ‘์†)

1. ๋จธ์‹ ๋Ÿฌ๋‹ ํŒŒ์ดํ”„๋ผ์ธ ๊ตฌ์ถ•

  • load_model, preprocessing, labeling ๋“ฑ๋“ฑ์˜ ํ•จ์ˆ˜ ์ž‘์„ฑ
  • issue : joblib๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ†ตํ•ด์„œ ๋กœ์ปฌ์— ์žˆ๋Š” ํฐ ์‚ฌ์ด์ฆˆ์˜ model์„ ๋ฐ”๋กœ ์„œ๋ฒ„์—์„œ ๋กœ๋“œํ•  ๊ฒฝ์šฐ ์†๋„ ๋ฌธ์ œ ๋ฐœ์ƒ

2. PostgreSQL & Docker๋ฅผ ํ™œ์šฉํ•œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ตฌํ˜„

  • docker๋ฅผ ํ†ตํ•ด์„œ postgreSQL ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์„ธํŒ…
  • postgreSQL์— ๋ฐ์ดํ„ฐ ์ ์žฌ

3. FastAPI๋ฅผ ํ™œ์šฉํ•œ Rest API ์„œ๋ฒ„ ๊ตฌํ˜„

  • reidsai๋ฅผ ํ†ตํ•œ model serving
  • exception ์ •์˜ ๋ฐ handler ์ž‘์„ฑ

4. Mlflow ๋ฐ Minio๋ฅผ ํ™œ์šฉํ•œ ๋ชจ๋ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๊ตฌํ˜„

  • mlflow๋ฅผ ํ†ตํ•œ ๋ชจ๋ธ๊ด€๋ฆฌ
  • mlflow ์™€ minio ์—ฐ๋™
โ”œโ”€โ”€ DB
โ”‚   โ”œโ”€โ”€ create_db.py
โ”‚   โ”œโ”€โ”€ database.py
โ”‚   โ””โ”€โ”€ models.py
โ”œโ”€โ”€ errors
โ”‚   โ”œโ”€โ”€ app_exceptions.py
โ”‚   โ”œโ”€โ”€ handlers.py
โ”‚   โ”œโ”€โ”€ request_exceptions.py
โ”‚   โ””โ”€โ”€ service_result.py
โ”œโ”€โ”€ routers
โ”‚   โ””โ”€โ”€ redisai.py
โ”‚   
โ””โ”€โ”€ schemas
    โ”œโ”€โ”€ request.py
    โ””โ”€โ”€ response.py