Cấu hình DVC Remote

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Ravi Bhadauria

Machine Learning Engineer

Ôn tập

  • Khởi tạo kho DVC
    • Chạy dvc init
    • Kho nằm trong workspace (/path/to/my-project)
  • Thiết lập bộ nhớ đệm (cache) DVC
    • Khu vực tạm trong thư mục .dvc
      • /path/to/my-project/.dvc/cache
    • Đưa tệp tạm vào stage bằng dvc add
  • Tiếp theo: DVC Remote
    • Lưu trữ bên ngoài
    • Theo dõi và chia sẻ tài nguyên
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Nhu cầu về DVC Remote

  • DVC Remote: nơi lưu dữ liệu
  • Tương tự Git remote, nhưng cho dữ liệu đã được cache
  • Lợi ích khi dùng remote
    • Đồng bộ tệp/thư mục lớn
    • Tập trung hoặc phân tán lưu trữ
    • Tiết kiệm dung lượng máy

Sơ đồ luồng dữ liệu từ DVC workspace đến cache và remote

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Các loại lưu trữ hỗ trợ

Đồ họa về các loại lưu trữ DVC hỗ trợ

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Thiết lập Remote

  • Thiết lập remote

    • dvc remote add <name> <location>
  • S3 bucket

$ dvc remote add s3_remote \
   s3://mys3bucket
  • Thay đổi trong cấu hình DVC
 ['remote "s3_remote"']
     url = s3://mys3bucket
  • GCP bucket
$ dvc remote add gcp_remote \
   gs://myGCPbucket
  • Azure
$ dvc remote add azure_remote \
   azure://mycontainer/path
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Remote cục bộ

  • Remote cục bộ dùng cho thử nghiệm nhanh
  • Dùng thư mục hệ thống hoặc NAS (Network Attached Storage)
$ dvc remote add mylocalremote /tmp/dvc
  • Đặt remote mặc định với cờ -d
$ dvc remote add -d mylocalremote /tmp/dvc
  • Remote mặc định được gán trong phần core của .dvc/config
[core]
remote = mylocalremote
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Liệt kê Remote

  • Liệt kê remote
$ dvc remote list
s3_remote    s3://mys3bucket
local_remote /tmp/dvcremote
  • Đọc từ .dvc/config
 ['remote "s3_remote"']
     url = s3://mys3bucket
 ['remote "local_remote"']
     url = /tmp/dvcremote
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Sửa cấu hình Remote

  • Tùy chỉnh bằng dvc remote modify
$ dvc remote modify s3_remote connect_timeout 300
  • Thay đổi trong tệp cấu hình DVC
 ['remote "s3_remote"']
     url = s3://mys3bucket
     connect_timeout = 300
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Tóm tắt

  • DVC remote dùng để chia sẻ dữ liệu và mô hình ML
  • Hỗ trợ nhiều vị trí lưu trữ cục bộ và đám mây
  • Thêm remote: dvc remote add
    • Dùng cờ -d để đặt mặc định
  • Liệt kê remote: dvc remote list
  • Sửa remote: dvc remote modify
Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Ayo berlatih!

Nhập môn Quản lý Phiên bản Dữ liệu với DVC

Preparing Video For Download...