1、git
有時候服務器不能直接訪問 github,下載代碼會很麻煩;安裝庫的時候,pip xx @git 就更難了
比如,這次我需要安裝 unsloth,官方給出的腳本是:
pip install “unsloth[cu121-torch220] @ git+https://github.com/unslothai/unsloth.git”
unsloth repo 下載后,沒有常見的 setup.py 文件,這要如何處理呢? 我沒有找到合適的方法
看一些教程,發現 學術加速的方法:https://mirror.ghproxy.com
我可以在服務器上,這樣下載 git:
git clone https://mirror.ghproxy.com/https://github.com/unslothai/unsloth.git
那么是否可以按這個模式 安裝呢? 嘗試了下,是可行的:
pip install “unsloth[cu121-torch211] @ git+https://mirror.ghproxy.com/https://github.com/unslothai/unsloth.git”
有時候會報下述錯誤,但再嘗試一次就好了
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
后記 : 有人說 把鏡像復制到gitee,然后 git gitee
這個也不錯
2、huggingface
借助 hf-mirror 下載數據:https://hf-mirror.com
export HF_ENDPOINT=https://hf-mirror.com
----下載模型
gated 模型需要 token,其他不需要則可以不加這個參數
huggingface-cli download --token hf_xxx meta-llama/Meta-Llama-Guard-2-8B --local-dir Llama-Guard-2-8B---- 下載數據
huggingface-cli download --repo-type dataset teknium/OpenHermes-2.5
你可以把 HF_ENDPOINT
寫到環境變量 ~/.bashrc
(linux), ~/.bash_profile
(macOS)
export HF_ENDPOINT=https://hf-mirror.com
保存、source 后,檢驗
echo $HF_ENDPOINT
2024-07-13(六)