kaggle notebook中使用git lfs

[亡魂溺海] 提交于 2019-12-02 12:56:32

#爲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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!