Baichuan-7B 介绍
Baichuan-7B 是由百川智能开发的一个开源可商用的大规模预训练语言模型。基于 Transformer 结构,在大约 1.2 万亿 tokens 上训练的 70 亿参数模型,支持中英双语,上下文窗口长度为 4096。在标准的中文和英文 benchmark(C-Eval/MMLU)上均取得同尺寸最好的效果。
项目介绍
本项目提供了 Baichuan-7B 非量化版本在 ModelWhale 平台 V100 机型上进行部署、推理测试教程
环境配置
计算资源:V100 Tensor Core GPU
镜像:Cuda11.3.1 PyTorch 1.10.2 Tensorflow2.8.0 Python 3.7 镜像
官方注:ModelWhale GPU机型需要从云厂商拉取算力资源,耗时5~10min,且会预扣半小时资源价格的鲸币。如果资源未启动成功,预扣费用会在关闭编程页面后五分钟内退回,无需紧张,如遇问题欢迎提报工单,客服会及时处理。
# 确认GPU型号与显存大小
!nvidia-smi
Tue Aug 29 17:17:10 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.102.04 Driver Version: 450.102.04 CUDA Version: 11.3 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla V100-SXM2... On | 00000000:00:08.0 Off | 0 |
| N/A 39C P0 24W / 300W | 0MiB / 32510MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
# 检查模型文件正确挂载
!ls -lh /home/mw/input/baichuan7b8214
total 14G
-rw-r--r-- 1 mw root 757K Aug 29 17:12 'baichuan-7B 模型许可协议.pdf'
-rw-r--r-- 1 mw root 656 Aug 29 17:12 config.json
-rw-r--r-- 1 mw root 2.3K Aug 29 17:12 configuration_baichuan.py
-rw-r--r-- 1 mw root 132 Aug 29 17:12 generation_config.json
-rw-r--r-- 1 mw root 1.1K Aug 29 17:12 handler.py
-rw-r--r-- 1 mw root 172K Aug 29 17:12 'License Agreement for Baichuan-7B Model.pdf'
-rw-r--r-- 1 mw root 28K Aug 29 17:12 modeling_baichuan.py
-rw-r--r-- 1 mw root 14G Aug 29 17:13 pytorch_model.bin
-rw-r--r-- 1 mw root 13K Aug 29 17:12 README.md
-rw-r--r-- 1 mw root 411 Aug 29 17:12 special_tokens_map.json
-rw-r--r-- 1 mw root 9.4K Aug 29 17:12 tokenization_baichuan.py
-rw-r--r-- 1 mw root 802 Aug 29 17:12 tokenizer_config.json
-rw-r--r-- 1 mw root 1.1M Aug 29 17:12 tokenizer.model