Comments (3)
临时解决方案
修改chatglm.h文件 to_device方法
void to_device() {
for(int i = 0;i < state_dict_.size();i++) {
ggml_tensor *tensor = state_dict_[i].second;
// should not place embedding onto device
if (tensor != transformer.word_embeddings.weight) {
if(i <= 125) {// 此处i值为自己制定 需要根据自己的电脑多次修改
tensor_to_device(tensor);//GPU加载部分
}else {
tensor_to_cpu(tensor);//CPU加载部分
}
}
}
for (auto &layer : transformer.layers) {
tensor_to_device(layer.attention.k_cache);
tensor_to_device(layer.attention.v_cache);
}
}
再次执行cmake 、make一系列操作
效果:解决只使用CPU版本时 速度慢需要大约1分多钟才有响应。使用原有GPU版本内存溢出 直接退出问题。
现在基本10s内就可以直接响应。充分利用CPU+GPU混合处理。
CPU: I5-6300HQ
GPU: GTX965M 4G版
系统:Win10
from chatglm.cpp.
大神,礼貌问一下现在还有更好的解决方案吗
from chatglm.cpp.
大神,礼貌问一下现在还有更好的解决方案吗
没有 本人也不是太懂C++
from chatglm.cpp.
Related Issues (20)
- 如何编译一个某类gpu兼容的 程序?
- 请问可以支持ChatGlm3-6b-128K模型量化吗
- 上下文推理时速度会变慢,请问应该怎么解决? HOT 2
- chatglm.cpp:152 check failed (messages.size() % 2 == 1) invalid chat messages size 2 HOT 2
- [Solved] Windows 上 chatglm_cpp 模块 "DLL load failed while importing _C" 问题 HOT 2
- pip install -U chatglm-cpp 失败: OSError: [WinError 1] 函数不正确。: 'R:\\Temp\\pip-build-env-mhz20gwx\\overlay\\Lib\\site-packages\\cmake\\data\\bin\\cmake-gui.exe'
- win11 chatglm3-6b 转换 q4_0报错
- build之后,缺少main文件
- GLM-4-9B已发布,是否有支持计划 HOT 12
- Will it support glm-4-9b-chat? HOT 1
- chatglm4: Run ./build/bin/main, Error: invalid model type 4 HOT 2
- Can't use web_demo in glm4 HOT 1
- glm4运行报错 HOT 1
- openai server非流式请求报错 HOT 6
- 请问是否支持了GLM-4V? HOT 7
- 使用openai_api.py启动量化后的glm4模型报错 HOT 4
- chatglm_cpp-0.3.4 终于成功了
- libre2.so.11 not found HOT 1
- glm4量化之后开始胡言乱语有人遇到过吗? HOT 7
- openai server出现空回答 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatglm.cpp.