dataset的版本使用lfs進行版本管理是比較方便的方式,但是github的lfs空間只有給1G,如果有不同的資料版本出現,很快github的lfs空間就滿了。
這邊要進行在github的repo中(當然也能置換成其他的git repo,例如gitea或是gitlab),把git lfs的位置轉換到hugging face dataset repo上,進行異地管理。
首先要確定:
1. 已經安裝好git
2. 已經安裝好git lfs
3. 把hugging face dataset 以及github repo都開好了
Process
Step1. Clone git repo
git clone git@github.com:markliou/xxx.git
Step 2. 在該repo底下創建資料夾(這邊範例名稱是cosmic_v101),並且把檔案放進去
mkdir cosmic_v101
Step 3. 設定LFS的位置,這邊假設是指定到 markliou/COSMIC_v101
git config -f .lfsconfig lfs.url git@hf.co:datasets/markliou/COSMIC_v101
確定看看設定狀況
git lfs env
git lfs track 'cosmic_v101/*'
Step 5. 將檔案還有.lfsconfig和.gitattributes推上去
git add . git commit -m "xx" git push
可以使用 git lfs ls-files看看資料夾裡面的檔案有沒有被追蹤到
Step 6. 檢查檔案有沒有上到hugging face。
首先到hugging face網頁上,找到setting的選項。這邊的舉例就是到 https://huggingface.co/datasets/markliou/COSMIC_v101/settings
接下來會看到 "List FPS files",點進去就應該可以看到檔案的hash。
後續只要對github的repo進行clone,就能把檔案一併抓下來。
Ref:
https://help.sonatype.com/en/git-lfs-repositories.html
https://github.com/git-lfs/git-lfs/wiki/Tutorial
https://huggingface.co/docs/hub/datasets-adding
https://huggingface.co/docs/hub/repositories-getting-started