Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

JINIers

Vertex AI: Qwik Start 본문

GCP/Qwiklabs

Vertex AI: Qwik Start

JINIers 2022. 4. 25. 14:26

220425_Vertex AI: Qwik Start
참고 : https://cloud.google.com/vertex-ai/docs/start/introduction-unified-platform

 


vertex AI 공부

- vertex AI란 : 필요한 ML 도구를 포함한 하나의 AI 플랫폼

특징

1. 전체 ML 워크플로를 위한 통합 UI
   - 하나의 통합 UI 및 API로 ML을 빌드하기 위해 google cloud 서비스를 한 곳에 모은 것

2. 비전, 동영상, 자연어 등을 위한 선행 학습된 API

3. 데이터 및 AI를 위한 end to end 통합
   - vertex AI Workbench를 통해 bigquery, dataproc, spark와 통합됨
   - 표준 sql 쿼리 사용 bigquery에서 머신러닝 모델 생성 및 실행
   - vertex data labeling 사용 데이터모음에 대한 라벨 정확하게 생성 가능

 

4. 모든 오픈소스 프레임워크 지원


체크포인트

1. vertex ai 노트북 만들기
2. 랩 리포지토리 복제


[개요]

bigquery를 데이터처리 및 탐색적 데이터 분석에 사용
vertex AI 플랫폼을 사용하여 맞춤형 tensorflow regressor 모델을 학습 및 배포하여 고객 평생 가치 예측
로컬 bigquery 및 tensorflow 워크플로 → vertex AI 사용 클라우드에서 모델을 학습 및 배포


[목표]

  • 호스팅된 vertex notebook에서 로컬로 tensorflow 모델을 훈련
  • 실험 추적을 위해 관리되는 테이블형식 데이터세트 아티팩트 만들기
  • cloud build로 학습코드 컨테이너화, google cloud artifact registry로 푸시
  • vertex tensorboard 사용하여 모델 성능 시각화
  • 예측을 제공하기 위해 학습된 모델을 vertex online prediction endpoint에 배포
  • 온라인 예측 및 설명 요청, 응답 확인

1. google cloud 서비스 사용

gcloud services enable \
  compute.googleapis.com \
  iam.googleapis.com \
  iamcredentials.googleapis.com \
  monitoring.googleapis.com \
  logging.googleapis.com \
  notebooks.googleapis.com \
  aiplatform.googleapis.com \
  bigquery.googleapis.com \
  artifactregistry.googleapis.com \
  cloudbuild.googleapis.com \
  container.googleapis.com

2. vertex tensorboard 통합을 위한 vertex ai 맞춤형 서비스 계정 생성


[맞춤 서비스 계정 만들기]

SERVICE_ACCOUNT_ID=vertex-custom-training-sa
gcloud iam service-accounts create $SERVICE_ACCOUNT_ID  \
    --description="A custom service account for Vertex custom training with Tensorboard" \
    --display-name="Vertex AI Custom Training"

[tensorboard 로그 작성 및 검색을 위해 GCS에 대한 액세스 권한 부여]

PROJECT_ID=$(gcloud config get-value core/project)
gcloud projects add-iam-policy-binding $PROJECT_ID \
    --member=serviceAccount:$SERVICE_ACCOUNT_ID@$PROJECT_ID.iam.gserviceaccount.com \
    --role="roles/storage.admin"

[tensorflow 모델로 데이터를 읽을 수 있도록 bigquery 데이터 소스에 대한 액세스 권한부여]

gcloud projects add-iam-policy-binding $PROJECT_ID \
    --member=serviceAccount:$SERVICE_ACCOUNT_ID@$PROJECT_ID.iam.gserviceaccount.com \
    --role="roles/bigquery.admin"

 

[모델교육, 배포 및 설명작업을 실행하기 위해 vertex AI에 대한 액세스 권한 부여]

 

gcloud projects add-iam-policy-binding $PROJECT_ID \
    --member=serviceAccount:$SERVICE_ACCOUNT_ID@$PROJECT_ID.iam.gserviceaccount.com \
    --role="roles/aiplatform.user"

 


3. vertex 노트북 인스턴스 배포

artificial intelligence > vertex ai > workbench > user-managed notebooks > create notebooks

- name : openjupyterlab(아무거나)
* 소문자만 가능
- environment : TensorFlow Enterprise 2.3 (with LTS and Intel® MKL-DNN/MKL)
- zone : us-central1

나머지는 건드리지 않고 생성한다.


4. 랩 리포지토리 복제


[training-data-analystJupyterLab 인스턴스에서 노트북 복제]

생성되면 openjupyterlab 눌러 > build > other > terminal

 

cd
git clone https://github.com/GoogleCloudPlatform/training-data-analyst



다운되면 training-data-analyst 파일 열어서 확인


5. 랩 종속성 설치

cd training-data-analyst/self-paced-labs/vertex-ai/vertex-ai-qwikstart
pip install -U -r requirements.txt


[랩 노트북으로 이동]

training-data-analyst/self-paced-labs/vertex-ai/vertex-ai-qwikstart 에서 lab_exercise.ipynb 열기

코드 실행 : '▶' 누르기 or shift+enter

Comments