美文网首页
从hugging face上clone大语言模型

从hugging face上clone大语言模型

作者: 梅西爱骑车 | 来源:发表于2023-12-16 14:52 被阅读0次

科学上网,http端口号10809.

方法1:

选择python依赖包,用代码程序解决
推荐:pycrawlers这个python包,使用这个包可以轻松实现批量下载,以及进度显示。

from pycrawlers import huggingface
# 实例化类
hg = huggingface()

# 1.批量下载
urls = ['https://huggingface.co/ziqingyang/chinese-llama-2-13b/tree/main',
        'https://huggingface.co/ziqingyang/chinese-llama-2-7b/tree/main']
           
# 默认保存位置在当前脚本所在文件夹 ./
hg.get_batch_data(urls)

# 2.单个下载
url = 'https://huggingface.co/ziqingyang/chinese-llama-2-13b/tree/main'

# 默认保存位置在当前脚本所在文件夹 ./
hg.get_data(url)


# 自定义下载位置
# 多个不同位置
paths = ['/home/model-gpt/chinese-llama-2-13b','/home/model-gpt/chinese-llama-2-7b']
hg.get_batch_data(urls, paths)

# 单一位置
path = '/home/model-gpt'
hg.get_data(url, path)

方法二

启动科学上网软件,配置科学上网的在Windows、Linux、Mac OS 中 git 命令相同.

git config --global http.proxy 127.0.0.1:10809
git config --global https.proxy 127.0.0.1:10809

git config --global http.proxy socks5 127.0.0.1:10808
git config --global https.proxy socks5 127.0.0.1:10808

查看:

git config --global --get http.proxy
git config --global --get https.proxy

取消:

git config --global --unset http.proxy
git config --global --unset https.proxy

比如下载sqlcoder,
进入官网:https://huggingface.co/defog/sqlcoder/tree/main
进入三个点,参考clone代码的命令:

clone命令

在命令行窗口执行clone命令,环境变量GIT_LFS_SKIP_SMUDGE=1代表我只下载大文件的指针。高版本的git已经自带lfs,克隆前需要执行git lfs install。

set GIT_LFS_SKIP_SMUDGE=1
git lfs install
git clone https://huggingface.co/defog/sqlcoder

如果网络不稳定,多试几次。成功下载的命令如下:



几个大文件现在都是指针,如果要真正部署要全部下载才行。


相关文章

网友评论

      本文标题:从hugging face上clone大语言模型

      本文链接:https://www.haomeiwen.com/subject/xohngdtx.html