侧边栏壁纸
博主头像
Eoser's page! 博主等级

@学习@生活@自己

  • 累计撰写 118 篇文章
  • 累计创建 30 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

BitNet运行大模型折腾事件

eoser
2025-02-17 / 0 评论 / 0 点赞 / 10 阅读 / 0 字

通过Anaconda搭建运行环境

1.下载anaconda安装包

wget https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh

2.安装anacconda

bash ./Anaconda3-2024.10-1-Linux-x86_64.sh
vim ~/.bashrc
# 添加如下内容
export PATH="$HOME/anaconda3/bin:$PATH"
export HF_ENDPOINT=https://hf-mirror.com
# 退出编辑后
source ~/.bashrc

3.新建运行环境

清华anaconda镜像配置:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

BitNet项目地址:https://github.com/microsoft/BitNet

# 拉项目
git clone --recursive https://github.com/microsoft/BitNet.git
cd BitNet
# 创建环境
conda create -n bitnet-cpp python=3.9
conda activate bitnet-cpp
# 配置镜像
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# conda 镜像
vim ${HOME}/.condarc

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

conda clean -i
conda config --set show_channel_urls yes
conda config --set custom_channels.pytorch https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
conda clean -i
# 拉取依赖
pip install -r requirements.txt

huggingface下载模型

huggingface官网https://huggingface.co 国内无法直接访问

国内镜像网站https://hf-mirror.com/

1.配置镜像,可以写入.bashrc持久化

export HF_ENDPOINT=https://hf-mirror.com

2.下载一个模型

huggingface-cli download 1bitLLM/bitnet_b1_58-xl --local-dir models/bitnet_b1_58-xl

3.运行模型:目前测试不行了,各个官方都喜欢乱搞,资料都不更新!!!现在的代码需要vllm来运行了

python setup_env.py -md models/bitnet_b1_58-xl -q i2_s

正式运行

该情况是运行的GPU版本,cpu需要自己编译

pip install vllm
vllm serve models/bitnet_b1_58-xl --trust-remote-code

0

评论区