kaggle notebook中使用git lfs
#爲kaggle notebook配置git-lfs
!curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | ?bash
!apt-get install -y --allow-unauthenticated git-lfs
?
# 下面是依賴包
!pip install pretrainedmodels
!pip install albumentations==0.3.0
!pip install addict
!rm -r RSNA666
!git clone https://github.com/appleyuchi/RSNA_kaggle_notebook
!cp /kaggle/input/cache666/*.pkl /kaggle/working/RSNA_kaggle_notebook/cache
!cd /kaggle/working/RSNA666;ls -l
!git clone https://github.com/NVIDIA/apex && cd apex && pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
?
#假定我們要保存的大文件是.pt權重,那麼我們假設保存在
www.github.com/appleyuchi/appleyuchi/RSNA_MODEL中:
如下:
?
!rm -r ?/kaggle/working/RSNA_MODEL
!git clone https://github.com/appleyuchi/RSNA_MODEL
!cp /kaggle/working/*.pt /kaggle/working/RSNA_MODEL
!cd /kaggle/working/RSNA_MODEL/;git lfs track "*.pt";git add .gitattributes;git add *.pt
!cd /kaggle/working/RSNA_MODEL/;git status
!cd /kaggle/working/RSNA_MODEL;git commit --allow-empty-message -m f''&&git push https://appleyuchi:密碼@github.com/appleyuchi/RSNA_MODEL.git --all
?
?
銷燬git上面的.pt模型文件(必須kaggle上操作,因爲我們是國內,github服務器是國外,我們不能在自己電腦上進行銷燬模型操作):
!git clone https://github.com/appleyuchi/RSNA_MODEL
!cd /kaggle/working/RSNA_MODEL;rm *.pt;git add *;git commit --allow-empty-message -m f''&&git push https://appleyuchi:密碼@github.com/appleyuchi/RSNA_MODEL.git --all
總結
以上是生活随笔為你收集整理的kaggle notebook中使用git lfs的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 修改文件后git只用两步push文件
- 下一篇: ubuntu18.10安装linuxqq