Compare commits
1 Commits
16db7e5395
...
1bd42f0dd6
| Author | SHA1 | Date | |
|---|---|---|---|
| 1bd42f0dd6 |
@@ -1,5 +0,0 @@
|
|||||||
FROM git.modelhub.org.cn:980/enginex-iluvatar/mr100_corex:4.3.0
|
|
||||||
|
|
||||||
WORKDIR /workspace
|
|
||||||
RUN pip install diffusers==0.34.0 sentencepiece transformers==4.55.2
|
|
||||||
COPY main.py test.sh dataset.json /workspace/
|
|
||||||
1
Dockerfile
Symbolic link
1
Dockerfile
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
Dockerfile.mrv100
|
||||||
5
Dockerfile.a100
Normal file
5
Dockerfile.a100
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
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/
|
||||||
6
Dockerfile.bi100
Normal file
6
Dockerfile.bi100
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
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/
|
||||||
7
Dockerfile.mrv100
Normal file
7
Dockerfile.mrv100
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
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/
|
||||||
25
README.md
25
README.md
@@ -1,19 +1,24 @@
|
|||||||
|
## Installation
|
||||||
|
参考Dockerfile,构建运行镜像
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
### 构建镜像
|
### 测试程序
|
||||||
|
1. 下载模型:https://modelscope.cn/models/AI-ModelScope/stable-diffusion-v1-5
|
||||||
|
|
||||||
|
2. 运行测试程序
|
||||||
|
|
||||||
|
修改测试程序`test.py`里面的模型路径,直接执行即可
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t diffusers:v0.1 .
|
python3 test.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### 模型下载
|
### 批量测试程序
|
||||||
模型地址:https://modelscope.cn/models/AI-ModelScope/stable-diffusion-v1-5
|
1. 准备输入数据集`dataset.json`,可以参考示例`dataset.json`
|
||||||
并放到目录:`/mnt/contest_ceph/zhanghao/models/stable-diffusion-v1-5`(如更改目录,请修改后面的执行脚本中的模型路径)
|
2. 运行测试程序
|
||||||
|
|
||||||
### 测试程序
|
|
||||||
1. 准备输入数据集,可以参考示例`dataset.json`
|
|
||||||
2. 在docker镜像里运行测试程序,会根据`dataset.json`内容,在`output`目录下生成图片文件。
|
|
||||||
```bash
|
```bash
|
||||||
./run_in_docker.sh
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
## 测试结果
|
## 测试结果
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
image=diffusers:v0.1
|
image=harbor-contest.4pd.io/zhanghao/diffusers:bi100-0.2
|
||||||
docker run -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
|
docker run -it -v /root/zhanghao:/workspace -v /mnt:/mnt --device=dev/iluvatar1:/dev/iluvatar0 $image bash
|
||||||
|
|||||||
3
run_in_docker_a100.sh
Executable file
3
run_in_docker_a100.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#! /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
|
||||||
3
run_in_docker_mrv100.sh
Executable file
3
run_in_docker_mrv100.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#! /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
Normal file
13
test.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
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")
|
||||||
Reference in New Issue
Block a user