DVCを初期化してデータセットを追跡する
dvc addを実行し、データではなくポインターをコミットします。
「DVCを初期化してデータセットを追跡する」はCoddyKit上の無料MLOps Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMLOps Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 MLOps Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Install DVC First
DVC is a Python package, so a single pip command gets you started. After this you have the dvc command available in your terminal.
pip install dvcStart Inside a Git Repo
DVC works alongside Git, not instead of it. So you run it inside an existing Git repository where your code already lives.
git init
dvc initWhat dvc init Creates
dvc init adds a hidden .dvc folder holding config and the local cache. Commit it once so the whole team shares the same setup.
git add .dvc .dvcignore
git commit -m "Initialize DVC"Track Your First Dataset
Point DVC at the file or folder you want versioned with dvc add. DVC moves the real data into its cache and leaves a small placeholder behind.
dvc add data/train.csvThe .dvc Pointer File
dvc add creates a tiny .dvc file next to your data. It stores the file's hash and size, acting as the address Git will track.
# data/train.csv.dvc
outs:
- md5: 3f2a9c...
size: 524288
path: train.csvGit Tracks the Pointer
You commit the small .dvc file to Git, never the raw dataset. Git now records which version of the data this commit expects.
git add data/train.csv.dvc
git commit -m "Track training data"Real Data Goes to .gitignore
So you never commit the big file by accident, dvc add auto-adds the dataset path to .gitignore. Git simply ignores the heavy bytes.
cat .gitignore
# /train.csvContent-Addressable Cache
DVC names cached files by their content hash. Identical data is stored once, so duplicate datasets never waste disk space. 💾
Check the Status
Run dvc status any time to see whether your working data matches what the .dvc files expect. It is your quick health check.
dvc statusUpdate a Tracked File
When the dataset changes, just run dvc add again. DVC recomputes the hash and updates the .dvc file, which you commit as a new version.
dvc add data/train.csv
git add data/train.csv.dvc
git commit -m "New data snapshot"Track Folders Too
dvc add works on whole directories, not just single files. Point it at a folder and DVC versions everything inside as one tracked unit.
dvc add data/images/Quick Check
After running dvc add on a dataset, what do you commit to Git?
Recap
You ran dvc init, then dvc add to track a dataset. DVC caches the real data and writes a tiny .dvc pointer that Git commits, keeping code and data linked.
よくある質問
「DVCを初期化してデータセットを追跡する」レッスンは無料ですか?
はい。「DVCを初期化してデータセットを追跡する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、MLOps Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 MLOps Academyコースには全4レッスンが含まれています。
「DVCを初期化してデータセットを追跡する」で何を学びますか?
dvc addを実行し、データではなくポインターをコミットします。 ブラウザで直接実行するハンズオンコードでMLOps Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
MLOps Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのMLOps Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「DVCを初期化してデータセットを追跡する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このMLOps Academyレッスンでコードを書いて実行できますか?
はい。すべてのMLOps Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Gitだけではデータのバージョン管理ができない理由
- DVCを初期化してデータセットを追跡する
- データをリモートストレージにプッシュする
- 以前のデータセットにロールバックする