50 lines
1.9 KiB
Markdown
50 lines
1.9 KiB
Markdown
Quickstart
|
||
---
|
||
|
||
### Docker Image
|
||
|
||
```bash
|
||
docker pull cr.metax-tech.com/public-ai-release/maca/diffusers.training:maca.ai3.0.0.5-torch2.4-py310-ubuntu22.04-amd64
|
||
```
|
||
|
||
### 模型
|
||
|
||
stable-diffusion-v1-5, 下载地址:
|
||
- [modelscope](https://modelscope.cn/models/AI-ModelScope/stable-diffusion-v1-5)
|
||
- [hugging face](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5)
|
||
|
||
|
||
### 测试程序
|
||
1. 准备输入数据集,可以参考示例`dataset.json`
|
||
2. 在docker镜像里运行测试程序,会根据`dataset.json`内容,在`output`目录下生成图片文件。
|
||
3. 示例使用 [metax-docker](https://developer.metax-tech.com/softnova/category?package_kind=Cloud&dimension=metax&chip_name=%E6%9B%A6%E4%BA%91C500%E7%B3%BB%E5%88%97&deliver_type=%E5%88%86%E5%B1%82%E5%8C%85&series_name=metax-docker) 做为演示 docker runtime, 如用原生 docker 需自行挂载 GPU 等设备到容器
|
||
|
||
### 完整示例
|
||
```bash
|
||
git clone https://git.modelhub.org.cn:9443/EngineX-MetaX/enginex-c_series-diffusers
|
||
docker pull cr.metax-tech.com/public-ai-release/maca/diffusers.training:maca.ai3.0.0.5-torch2.4-py310-ubuntu22.04-amd64
|
||
|
||
cd enginex-c_series-diffusers/
|
||
# git clone 先确认 git-lfs 已安装
|
||
git lfs install
|
||
git clone https://www.modelscope.cn/AI-ModelScope/stable-diffusion-v1-5.git
|
||
|
||
metax-docker run --gpus=[0] -it --entrypoint /bin/bash -v $(realpath .):/workspace/app -v $(realpath stable-diffusion-v1-5):/model --entrypoint /bin/bash cr.metax-tech.com/public-ai-release/maca/diffusers.training:maca.ai3.0.0.5-torch2.4-py310-ubuntu22.04-amd64
|
||
|
||
#> inside container
|
||
cd app/
|
||
python3 main.py \
|
||
--model "/model" \
|
||
--json "dataset.json" \
|
||
--results "results.json" \
|
||
--outdir "output" \
|
||
--device cuda \
|
||
--dtype fp16
|
||
```
|
||
|
||
### 测试结果
|
||
| | A100 平均生成时间(秒) | MetaX C500 平均生成时间(秒) |
|
||
|------|-------------------------|----------------------------|
|
||
| 时间 | 2.2142 | 4.5260 |
|
||
|