主要ダウンロードツールの適用シーン
- git/git-lfs: バージョン管理、オープンソースプロジェクトの複製、重みデータを含むリポジトリ取得時に使用
- huggingface-cli: Hugging Face Hubから事前学習済みモデルや設定ファイルをダウンロード。レジューム機能とキャッシュ管理を内蔵
- wget: 単一HTTP/HTTPSファイルのバックグラウンドダウンロード。認証が不要な直接リンクに最適
- rsync: ローカル開発機とリモートGPUサーバー間の双方向同期。差分同期で転送時間を大幅削減
- curl: ネットワーク接続テスト、HTTPヘッダ確認、スクリプトのパイプライン実行に利用
- aria2c: 大容量ファイルのマルチスレッドダウンロード。サーバー側の帯域制限を回避
Git操作の基本
初期設定
git --version
git config --global user.name "ユーザー名"
git config --global user.email user@example.com
git config --global credential.helper store
リポジトリ操作
git init
git clone https://github.com/user/repo.git
git clone --depth 1 -b main https://github.com/user/repo.git
サブモジュール管理
git submodule add https://github.com/user/submodule.git
git submodule update --init --recursive
ファイル状態管理
git status -s
git add filename.txt
git add --all
git reset filename.txt
git rm file_to_remove.txt
コミット操作
git commit -m "コミットメッセージ"
git commit -a -m "一括コミット"
git commit --amend
履歴確認
git log --oneline
git log -n 5
git log --graph --oneline --all
ブランチ操作
git branch new-feature
git checkout new-feature
git switch main
git branch -d old-branch
リモート操作
git remote -v
git remote add origin https://github.com/user/repo.git
git push -u origin main
git fetch origin
git pull origin main
マージとリベース
git merge feature-branch
git rebase main
git rebase --continue
タグ管理
git tag v1.0.0
git tag -a v1.1.0 -m "リリースバージョン"
git push origin v1.0.0
変更の取り消し
git reset --soft HEAD~1
git reset --hard COMMIT_HASH
git revert COMMIT_HASH
git stash
git stash pop
差分確認
git diff HEAD
git diff --cached
git diff COMMIT1 COMMIT2
Git LFSの活用
初期設定
git lfs install
git lfs track "*.zip"
git lfs track "*.h5"
ファイル操作
git add large_file.dat
git commit -m "大容量ファイル追加"
git lfs push origin main
状態確認
git lfs status
git lfs ls-files
git lfs prune
Hugging Face CLI
インストールと認証
pip install huggingface-hub[cli]
huggingface-cli login
モデルダウンロード
huggingface-cli download user/model-name
huggingface-cli download user/model-name --local-dir ./model
アップロード操作
huggingface-cli upload user/repo ./local-file
huggingface-cli repo create new-repo --private
Wgetの実用コマンド
wget https://example.com/file.zip
wget -c https://example.com/large-file.iso
wget -r -l 2 https://example.com/
wget --limit-rate=1m https://example.com/file.bin
Curlの応用操作
curl -O https://example.com/file.txt
curl -H "Authorization: Bearer TOKEN" https://api.example.com/data
curl -X POST -d "param=value" https://api.example.com/endpoint
Aria2cの高速ダウンロード
aria2c -s 16 -x 16 https://example.com/large-file.tar.gz
aria2c --max-download-limit=10M https://example.com/file.iso
aria2c -i download-list.txt