Files
hackrobot 5bcc3a51fd 'mmm'
2024-08-03 14:18:12 +08:00

66 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## tinyllama
> 可部署在边缘计算设备的小模型
开源地址:`https://github.com/jzhang38/TinyLlama`
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202402022331373.png)
采用了与 Llama 2 完全相同的架构和分词器。这TinyLlama 可以在许多基于 Llama 的开源项目中即插即用。此外TinyLlama 结构紧凑,参数仅为 1.1B。这种紧凑性使其能够满足需要有限计算和内存占用的多种应用程序的需求
类似的小模型还有
- 微软开源的phi-2
- 阿里开源的Qwen-1.8B
---
## 开发板CPU测试
> 基于RK3588芯片
下载模型
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202402022331798.png)
测试数据,根据问题的长度,可以达到10-20token/s
这在不依靠GPU计算的环境下,已经是非常好的速度了
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202402022331103.png)
但是阿里的通义千问,就慢的令人发指,完全不能正常使用
---
## 使用llama.cpp部署模型
```python
pip install llama-cpp-python
```
参考示例
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202402022331464.png)
---
## api调用
> llama.cpp-python会默认生成swagger文档
直接按照格式发起post请求就好啦
并且其设计结构与openai一致
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202402022332514.png)
---
## 开源webui界面
> [ChatGPT-Next-Web](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web)
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202402022332581.png)