Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有mac部署方法吗,能用GPU么,需要多少内存 #35

Closed
liaoweiguo opened this issue Jul 12, 2023 · 3 comments
Closed

有mac部署方法吗,能用GPU么,需要多少内存 #35

liaoweiguo opened this issue Jul 12, 2023 · 3 comments

Comments

@liaoweiguo
Copy link

No description provided.

@alitrack
Copy link

把模型下载到本地,

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,都使用虚拟内存了。
image

@tankxiaodi
Copy link

感谢楼上兄弟, 我用了你的设置在Mac上成功跑起了,M1 Max + 64G内存速度可以接受。
不过今天看到有人搞了ggml的版本:

https://huggingface.co/xuqinyang/baichuan-13b-chat-ggml-int8

@tain198127
Copy link

感谢楼上兄弟, 我用了你的设置在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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants