🙌
git-lfsを使わずにhugging faceのレポジトリをダウンロードする
経緯
- クラウド上の計算機サーバで機械学習モデルをhugging faceからダウンロードしようとした。
 - 公式ではgit-lfsを使うように書いてあったが、リモート環境でsudoが使えなかったためインストールできない。
 - そこでpythonのhuggingface_hubを使ってダウンロードした。
 
方法
- 以下のコードをpythonで実行
 
import huggingface_hub
 
model_id = "stabilityai/stable-diffusion-2-1-base"  # レポジトリ名
local_dir = "models"  # 保存先フォルダ名
huggingface_hub.snapshot_download(model_id, local_dir=local_dir, local_dir_use_symlinks=False)
参考にした記事
Discussion