Compare commits

...

11 Commits

Author SHA1 Message Date
dog
7c6e52bb31 Update README.md 2025-12-03 14:19:41 +08:00
zhousha
4366128139 update Dockerfile 2025-09-15 17:44:24 +08:00
455848137a mount current dir to workspace 2025-08-28 17:51:11 +08:00
faf81388ba 更新 Dockerfile 2025-08-28 17:29:41 +08:00
e178e4de4a 更新 Dockerfile 2025-08-28 17:28:23 +08:00
16db7e5395 remove uncessary files 2025-08-26 20:36:24 +08:00
be947dfc79 update readme 2025-08-26 18:13:06 +08:00
fcf7f30797 update base image of a100 2025-08-26 17:31:39 +08:00
b9906fa791 change base image for mlu370 2025-08-26 17:25:25 +08:00
root
ce8d16c160 update run_in_docker_mlu370 scripts 2025-08-26 15:35:32 +08:00
b524f25741 support mlu370 2025-08-25 17:07:12 +08:00
10 changed files with 55 additions and 59 deletions

View File

@@ -1 +0,0 @@
Dockerfile.bi100

5
Dockerfile Normal file
View File

@@ -0,0 +1,5 @@
FROM corex:4.3.0
WORKDIR /workspace
RUN pip install diffusers==0.34.0 sentencepiece transformers==4.55.2
COPY main.py dataset.json /workspace/

View File

@@ -1,5 +0,0 @@
FROM harbor-contest.4pd.io/zhangyiqun/public/pytorch:2.6.0-cuda12.4-cudnn9-devel
WORKDIR /workspace
# ENV PT_SDPA_ENABLE_HEAD_DIM_PADDING=1
RUN pip install diffusers transformers sentencepiece -i https://nexus.4pd.io/repository/pypi-all/simple
COPY main.py test.sh dataset.json /workspace/

View File

@@ -1,6 +0,0 @@
FROM git.modelhub.org.cn:980/enginex-iluvatar/bi100-3.2.1-x86-ubuntu20.04-py3.10-poc-llm-infer:v1.2.2
WORKDIR /workspace
ENV PT_SDPA_ENABLE_HEAD_DIM_PADDING=1
RUN pip install diffusers==0.34.0
COPY main.py test.sh dataset.json /workspace/

View File

@@ -1,7 +0,0 @@
FROM git.modelhub.org.cn:980/enginex-iluvatar/mr100_corex:4.3.0
WORKDIR /workspace
COPY whls-mrv100 /packages
RUN pip install diffusers==0.34.0 sentencepiece transformers==4.55.2
# RUN pip install /packages/*.whl
COPY main.py test.sh dataset.json /workspace/

View File

@@ -1,28 +1,58 @@
## Installation
参考Dockerfile构建运行镜像
## Quickstart
### 测试程序
1. 下载模型https://modelscope.cn/models/AI-ModelScope/stable-diffusion-v1-5
2. 运行测试程序
修改测试程序`test.py`里面的模型路径,直接执行即可
### 构建镜像
```bash
python3 test.py
docker build -t diffusers:v0.1 .
```
其中,基础镜像 corex:4.3.0 通过联系天数智芯智铠100厂商技术支持可获取
### 批量测试程序
1. 准备输入数据集`dataset.json`,可以参考示例`dataset.json`
2. 运行测试程序
### 模型下载
模型地址https://modelscope.cn/models/AI-ModelScope/stable-diffusion-v1-5
并放到目录:`/mnt/contest_ceph/zhanghao/models/stable-diffusion-v1-5`(如更改目录,请修改后面的执行脚本中的模型路径)
### 测试程序
1. 准备输入数据集,可以参考示例`dataset.json`
2. 在docker镜像里运行测试程序会根据`dataset.json`内容,在`output`目录下生成图片文件。
```bash
python3 main.py --model "/mnt/contest_ceph/zhanghao/models/stable-diffusion-v1-5" --json "dataset.json" --results "results.json" --outdir "output" --device cuda --dtype fp16
./run_in_docker.sh
```
## 测试结果
| | A100 平均生成时间(秒) | 天垓100 平均生成时间(秒) |
|------|-------------------------|----------------------------|
| 时间 | 1.4289 | 7.5609 |
| 模型名称 | A100 平均生成时间(秒) | 智铠100 平均生成时间(秒) | 备注 |
| ----- | ----- | ----- | ----- |
| AI-ModelScope/stable-diffusion-3.5-medium | 5.3253 | 56.6237 | |
| AI-ModelScope/stable-diffusion-v1-5 | 1.3944 | 3.9280 | |
| AI-ModelScope/stable-diffusion-v1-5 | 3.0271 | 6.9434 | |
| AI-ModelScope/stable-diffusion-v1-5 | 3.5003 | 6.9644 | |
| AI-ModelScope/stable-diffusion-v1-5 | 1.5982 | 3.9384 | |
| Cleaner/lo_dress_gothic_style2_v2 | 3.4047 | 12.7571 | |
| Cleaner/lo_dress_gothic_style2_v2 | 1.8821 | 2.5121 | |
| Cleaner/Tyndalleffect_Light | 3.3741 | 12.2595 | |
| Cleaner/Tyndalleffect_Light | 1.7133 | 2.5138 | |
| HanYixuan1/Retro_style | 3.6395 | 7.6439 | |
| HanYixuan1/Retro_style | 1.6764 | 2.4901 | |
| JeffVan/Oil_Paint_Style_LORA | 3.7807 | 6.9419 | |
| JeffVan/Oil_Paint_Style_LORA | 1.6673 | 2.7132 | |
| lljjcc/IndianSarres | 3.8178 | 12.5799 | |
| lljjcc/IndianSarres | 1.7252 | 2.5209 | |
| lljjcc/outdoor | 3.7997 | 12.8596 | |
| lljjcc/outdoor | 1.6684 | 2.5230 | |
| muse/flux_vae | 1.0812 | 2.5350 | |
| MusePublic/489_ckpt_FLUX_1/base_model | 1.2286 | 2.5382 | |
| rewfueranro/cartoon_lora | 2.7893 | 6.9129 | |
| rewfueranro/cartoon_lora | 1.6880 | 2.6043 | |
| YorickHe/fairy_lora | 3.6555 | 7.1317 | |
| YorickHe/fairy_lora | 1.7765 | 2.5139 | |
| YorickHe/JK_uniform_lora | 2.8396 | 6.8613 | |
| YorickHe/JK_uniform_lora | 1.7844 | 2.5219 | |
| YorickHe/outdoor_photo_lora | 3.7066 | 7.0899 | |
| YorickHe/outdoor_photo_lora | 1.6441 | 2.4851 | |
| YorickHe/polaroid_lora | 3.7494 | 7.1097 | |
| YorickHe/polaroid_lora | 1.6272 | 2.5117 | |
| YorickHe/Winter_hanfu_lora | 2.8050 | 7.1169 | |
| YorickHe/Winter_hanfu_lora | 1.5962 | 2.4892 | |
| ZackWang123/filmvelvia_lora | 3.3700 | 6.9867 | |
| ZackWang123/filmvelvia_lora | 1.8465 | 2.5157 | |
| zhanghaohit/karlo-v1-alpha | 3.2812 | 18.8275 | |
| zhanghaohit/karlo-v1-alpha | 3.2040 | 18.8392 | |

View File

@@ -1,3 +1,3 @@
#! /usr/bin/env bash
image=harbor-contest.4pd.io/zhanghao/diffusers:bi100-0.2
docker run -it -v /root/zhanghao:/workspace -v /mnt:/mnt --device=dev/iluvatar1:/dev/iluvatar0 $image bash
image=diffusers:v0.1
docker run -v `pwd`:/workspace -v /mnt/contest_ceph/zhanghao/models/stable-diffusion-v1-5:/workspace/stable-diffusion-v1-5 --device=dev/iluvatar1:/dev/iluvatar0 $image python3 main.py --model "./stable-diffusion-v1-5" --json "dataset.json" --results "results.json" --outdir "output" --device cuda --dtype fp16

View File

@@ -1,3 +0,0 @@
#! /usr/bin/env bash
image=harbor-contest.4pd.io/zhanghao/diffusers:a100-0.2
docker run -it -v /home/zhanghao/workspace:/workspace -v /mnt:/mnt $image bash

View File

@@ -1,3 +0,0 @@
#! /usr/bin/env bash
image=harbor-contest.4pd.io/zhanghao/diffusers:mrv100-0.2
docker run -it -v /root/zhanghao:/workspace -v /mnt:/mnt --device=dev/iluvatar0:/dev/iluvatar0 $image bash

13
test.py
View File

@@ -1,13 +0,0 @@
from diffusers import DiffusionPipeline
import torch
import time
model_path = "/mnt/contest_ceph/zhanghao/models/stable-diffusion-v1-5"
# model_path = "/mnt/contest_ceph/zhanghao/models/stable-diffusion-3.5-medium"
pipeline = DiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float16)
pipeline.to("cuda")
start = time.time()
image = pipeline("An image of a squirrel in Picasso style").images[0]
end = time.time()
print(f"elapsed: {end - start}")
image.save("squirrel_picasso.png")

View File

@@ -1 +0,0 @@
python3 main.py --model "/mnt/contest_ceph/zhanghao/models/stable-diffusion-v1-5" --json "dataset.json" --results "results.json" --outdir "output" --device cuda --dtype fp16