欢迎来到科站长!

其它综合

当前位置: 主页 > 网络编程 > 其它综合

本地部署 torchchat的详细过程

时间:2024-09-18 14:42:30|栏目:其它综合|点击:

本地部署 torchchat

0. 引言

TorchChat 是一个小型代码库,展示了无缝运行大型语言模型 (LLMs) 的能力。使用 torchchat,您可以在自己的 (C/C++) 应用程序(桌面或服务器)以及 iOS 和 Android 上使用 Python 运行LLMs。

1. 本地部署

1-1. 创建虚拟环境

1
2
conda create -n torchchat python=3.12 -y
conda activate torchchat

1-2. 克隆代

1
git clone https://github.com/pytorch/torchchat.git

1-3. 安装依赖模块

1
./install_requirements.sh

(20240816时点)我的wls-ubuntu环境会报以下错误,

+ python scripts/patch_triton.py
/mnt/e/workspace/torchchat/scripts/patch_triton.py:20: SyntaxWarning: invalid escape sequence '\s'
  new_match = 'self.src = self.src[re.search(r"^def\s+\w+\s*\(", self.src, re.MULTILINE).start():]'

临时解决方法,

vi /mnt/e/workspace/torchchat/scripts/patch_triton.py
---
# new_match = 'self.src = self.src[re.search(r"^def\s+\w+\s*\(", self.src, re.MULTILINE).start():]'
new_match = r'self.src = self.src[re.search(r"^def\s+\w+\s*\(", self.src, re.MULTILINE).start():]'
---

重新运行,

1
./install_requirements.sh

1-4. 下载模型

登录 Hugging Face,完成此操作后,torchchat 将能够从 Hugging Face 下载模型工件。

1
huggingface-cli login

查看现在支持的模型,

# python3 torchchat.py list
Model                                   Aliases                                     Downloaded
--------------------------------------- ------------------------------------------- -----------
meta-llama/llama-2-7b-hf                llama2-base, llama2-7b
meta-llama/llama-2-7b-chat-hf           llama2, llama2-chat, llama2-7b-chat
meta-llama/llama-2-13b-chat-hf          llama2-13b-chat
meta-llama/llama-2-70b-chat-hf          llama2-70b-chat
meta-llama/meta-llama-3-8b              llama3-base
meta-llama/meta-llama-3-8b-instruct     llama3, llama3-chat, llama3-instruct
meta-llama/meta-llama-3-70b-instruct    llama3-70b
meta-llama/meta-llama-3.1-8b            llama3.1-base
meta-llama/meta-llama-3.1-8b-instruct   llama3.1, llama3.1-chat, llama3.1-instruct  Yes
meta-llama/meta-llama-3.1-70b-instruct  llama3.1-70b
meta-llama/codellama-7b-python-hf       codellama, codellama-7b
meta-llama/codellama-34b-python-hf      codellama-34b
mistralai/mistral-7b-v0.1               mistral-7b-v01-base
mistralai/mistral-7b-instruct-v0.1      mistral-7b-v01-instruct
mistralai/mistral-7b-instruct-v0.2      mistral, mistral-7b, mistral-7b-instruct
openlm-research/open_llama_7b           open-llama, open-llama-7b
stories15m
stories42m
stories110m


上一篇:JSON常用的几种注释代码示例

栏    目:其它综合

下一篇:Hive 判断某个字段长度的示例代码

本文标题:本地部署 torchchat的详细过程

本文地址:https://fushidao.cc/wangluobiancheng/701.html

广告投放 | 联系我们 | 版权申明

申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:1205677645 | 邮箱:1205677645@qq.com

Copyright © 2018-2024 科站长 版权所有冀ICP备14023439号