
pip install dvc\[all] 을 통해 지원 패키지 설치 가능dvc add: metadata 파일 생성 (.dvc)git pull: metadata 정보 받기dvc pull: storage 에서 실제 데이터 다운python>3.8 과 git 이 필요하다conda create -n dvc-env python=3.8 -y
sudo apt install git
git --version
>> git version 2.25.1
pip install dvc[all]
# -p : 중간 경로까지 한번에 생성
mkdir -p ~/working/dvc-storage && cd ~/working/dvc-storage
git init
dvc init
mkdir data
cd data
echo "Hello DVC!" > demo.txt
dvc add demo.txt
ls
>>> demo.txt demo.txt.dvc
대용량의 데이터는 git 으로 관리할 수 없기 때문에, metadata 를 git으로 관리하고, 실제 데이터는 DVC 로 관리하는 것이다.
git add demo.txt.dvc .gitignore
git commit -m "add: .dvc"
dvc remote add -d <YOUR_STORAGE_NAME> gdrive://<GOOGLE_DRIVE_FOLDER_ID>
>>> Setting 'storage' as a default remote.
dvc remote modify <YOUR_STORAGE_NAME> gdrive_client_id <YOUR_CLIENT_ID>
dvc remote modify <YOUR_STORAGE_NAME> gdrive_client_secret <YOUR_CLIENT_SECRET>
git add .dvc/config
git commit -m "add: remote storage and client"
dvc push
dvc pull
checkout 은 데이터의 버전을 변경하는 명령어다.# 파일 수정
echo "Bye DVC!" > demo.txt
cat demo.txt
>>> Bye DVC!
# 수정된 파일 및 metadata 를 track
dvc add demo.txt
git add demo.txt.dvc
git commit -m "edit: demo"
# 수정된 파일을 remote 에 저장
dvc push
# git log 확인
git log --oneline
>>> 8a504f7 (HEAD -> master) edit: demo
>>> 0521cc9 add: storage and client
>>> ef06abb add: .dvc
# 가져오고 싶은 version 선택 및 이동
git checkout ef06abb demo.txt.dvc
dvc checkout
cat demo.txt
>>> Hello DVC!