#爲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
来源:https://blog.csdn.net/appleyuchi/article/details/102761208