Baichuan-13B
Baichuan-13B copied to clipboard
有mac部署方法吗,能用GPU么,需要多少内存
把模型下载到本地,
brew install git-lfs
git lfs install
git clone https://huggingface.co/baichuan-inc/Baichuan-13B-Chat
如果网络问题,可以收工下载模型文件
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/baichuan-inc/Baichuan-13B-Chat
模型使用本地路径
使用mps加速model = model.to('mps')
量化不支持Mac,暂时无解
不管cl_demo.py 还是web_demo.py 都如下修改,
pretrained_model_name = "./model/Baichuan-13B-Chat/"
st.set_page_config(page_title="Baichuan-13B-Chat")
st.title("Baichuan-13B-Chat")
@st.cache_resource
def init_model():
model = AutoModelForCausalLM.from_pretrained(
pretrained_model_name,
torch_dtype=torch.float16,
# device_map="auto",
trust_remote_code=True
)
model = model.to('mps')
model.generation_config = GenerationConfig.from_pretrained(
pretrained_model_name
)
tokenizer = AutoTokenizer.from_pretrained(
pretrained_model_name,
use_fast=False,
trust_remote_code=True
)
return model, tokenizer
我的系统是:
MacBook Pro M2 Max(12核CPU, 38核GPU, 32G内存)
使用情况,能跑起来,但没有啥意义,太慢。
内存使用最多超过32G,都使用虚拟内存了。
感谢楼上兄弟, 我用了你的设置在Mac上成功跑起了,M1 Max + 64G内存速度可以接受。 不过今天看到有人搞了ggml的版本:
https://huggingface.co/xuqinyang/baichuan-13b-chat-ggml-int8
感谢楼上兄弟, 我用了你的设置在Mac上成功跑起了,M1 Max + 64G内存速度可以接受。 不过今天看到有人搞了ggml的版本:
https://huggingface.co/xuqinyang/baichuan-13b-chat-ggml-int8
does it work well? My mac is mac book m1max 64G, could it work well?