模型上传
使用Gear模型构建工具上传您的自定义模型。
1. 说明
- 本工具仅支持 MacOS 和 Linux
- 操作机需要 准备 docker 环境
2. 安装 Gear
sudo curl -o /usr/local/bin/gear -L http://oss-high-qy01.cdsgss.com/gear/gear_`uname -s`_`uname -m` && sudo chmod +x /usr/local/bin/gear
3. 启动模型
3.1. 初始化
mkdir qwen0_5B && cd qwen0_5B
$ gear init
Setting up the current directory for use with gear...
✅ Created /data/qwen/predict.py
✅ Created /data/qwen/.dockerignore
✅ Created /data/qwen/.github/workflows/push.yaml
✅ Created /data/qwen/gear.yaml
Done!
3.2. 准备模型文件
目前不支持从远端拉取模型文件 , 需下载自己的模型到本地
$ git clone https://hf-mirror.com/Qwen/Qwen2.5-0.5B
Cloning into 'Qwen2.5-0.5B'...
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (39/39), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 42 (delta 18), reused 0 (delta 0), pack-reused 3 (from 1)
Unpacking objects: 100% (42/42), 3.61 MiB | 3.99 MiB/s, done.
3.3. 准备 gear.yaml 配置文件
# Configuration for gear ⚙️
build:
# 是否需要gpu
gpu: true
# 需要安装的ubuntu系统包
# system_packages:
# - "libgl1-mesa-glx"
# - "libglib2.0-0"
# python 版本号 '3.11'
python_version: "3.11"
# python包 <package-name>==<version>
python_packages:
- "transformers"
- "torch"
- "accelerate>=0.26.0"
# 环境设置完成后运行的命令
# run:
# - "echo env is ready!"
# - "echo another command if needed"
# predict.py 定义了如何在模型上运行预测
predict: "predict.py:Predictor"
# 控制请求并发数, 如果指定此配置需要 preict.py中的 `def predict` 需改为 `async def predict`
# concurrency:
# max: 20