当前位置:   article > 正文

git、huggingface 学术加速

git、huggingface 学术加速

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
  • 1

保存、source 后,检验

echo $HF_ENDPOINT
  • 1

2024-07-13(六)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/832107
推荐阅读
  

闽ICP备14008679号