Update README.md

更新macbook pro 不能正常执行的代码逻辑
pull/147/head
limix 2023-07-01 22:21:45 +08:00 committed by GitHub
parent 53f0106817
commit 543cfcd299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -157,6 +157,13 @@ cd ChatGLM2-6B
如果这些方法无法帮助你入睡,你可以考虑咨询医生或睡眠专家,寻求进一步的建议。
```
* 针对macbook pro m1max 电脑,请使用以下命令 ``AutoModel.from_pretrained("THUDM/chatglm2-6b", trust_remote_code=True, device='cuda')``替换
```python
model = AutoModel.from_pretrained("THUDM/chatglm2-6b", trust_remote_code=True).half().to('mps')
```
#### 从本地加载模型
以上代码会由 `transformers` 自动下载模型实现和参数。完整的模型实现在 [Hugging Face Hub](https://huggingface.co/THUDM/chatglm2-6b)。如果你的网络环境较差,下载模型参数可能会花费较长时间甚至失败。此时可以先将模型下载到本地,然后从本地加载。