diff --git a/Dockerfile b/Dockerfile deleted file mode 120000 index 45d555f..0000000 --- a/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -Dockerfile.bi100 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9131487 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM git.modelhub.org.cn:9443/enginex-cambricon/mlu370-pytorch:v25.01-torch2.5.0-torchmlu1.24.1-ubuntu22.04-py310 + +WORKDIR /workspace +ENV PATH=/torch/venv3/pytorch_infer/bin:/workspace/ffmpeg-mlu-v4.2.0/install/bin:/usr/local/neuware/bin:/usr/local/openmpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +RUN pip install diffusers==0.34.0 +RUN sed -i 's|source /torch/venv3/pytorch/bin/activate|source /torch/venv3/pytorch_infer/bin/activate|' /root/.bashrc +COPY main.py test.sh dataset.json /workspace/ diff --git a/Dockerfile.a100 b/Dockerfile.a100 deleted file mode 100644 index 1a9d182..0000000 --- a/Dockerfile.a100 +++ /dev/null @@ -1,5 +0,0 @@ -FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel -WORKDIR /workspace -# ENV PT_SDPA_ENABLE_HEAD_DIM_PADDING=1 -RUN pip install diffusers transformers sentencepiece -COPY main.py test.sh dataset.json /workspace/ diff --git a/Dockerfile.bi100 b/Dockerfile.bi100 deleted file mode 100644 index 364c3c9..0000000 --- a/Dockerfile.bi100 +++ /dev/null @@ -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/ diff --git a/Dockerfile.mlu370 b/Dockerfile.mlu370 deleted file mode 100644 index 9131487..0000000 --- a/Dockerfile.mlu370 +++ /dev/null @@ -1,8 +0,0 @@ -FROM git.modelhub.org.cn:9443/enginex-cambricon/mlu370-pytorch:v25.01-torch2.5.0-torchmlu1.24.1-ubuntu22.04-py310 - -WORKDIR /workspace -ENV PATH=/torch/venv3/pytorch_infer/bin:/workspace/ffmpeg-mlu-v4.2.0/install/bin:/usr/local/neuware/bin:/usr/local/openmpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -RUN pip install diffusers==0.34.0 -RUN sed -i 's|source /torch/venv3/pytorch/bin/activate|source /torch/venv3/pytorch_infer/bin/activate|' /root/.bashrc -COPY main.py test.sh dataset.json /workspace/ diff --git a/Dockerfile.mrv100 b/Dockerfile.mrv100 deleted file mode 100644 index cad8f22..0000000 --- a/Dockerfile.mrv100 +++ /dev/null @@ -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/ diff --git a/README.md b/README.md index 60ed53c..e06a724 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ docker build -t diffusers:v0.1 . ``` ## 测试结果 -| | A100 平均生成时间(秒) | 天垓100 平均生成时间(秒) | -|------|-------------------------|----------------------------| -| 时间 | 1.4289 | 7.5609 | +| | A100 平均生成时间(秒) | MLU370-x4 平均生成时间(秒) | MLU370-x8 平均生成时间(秒) | +|------|-------------------------|----------------------------|----------------------------| +| 时间 | 1.5 | 4.2 | 5.3 | diff --git a/run_in_docker.sh b/run_in_docker.sh index 0767548..7ba15c0 100755 --- a/run_in_docker.sh +++ b/run_in_docker.sh @@ -1,3 +1,4 @@ #! /usr/bin/env bash image=diffusers:v0.1 -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 \ No newline at end of file +device=cambricon_dev1 +docker run -v /mnt/contest_ceph/zhanghao/models/stable-diffusion-v1-5:/workspace/stable-diffusion-v1-5 --device=/dev/$device:/dev/cambricon_dev0 --device=/dev/cambricon_ctl:/dev/cambricon_ctl $image python3 main.py --model "./stable-diffusion-v1-5" --json "dataset.json" --results "results.json" --outdir "output" --device cuda --dtype fp16 diff --git a/run_in_docker_a100.sh b/run_in_docker_a100.sh deleted file mode 100755 index 85a12cb..0000000 --- a/run_in_docker_a100.sh +++ /dev/null @@ -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 diff --git a/run_in_docker_bi100.sh b/run_in_docker_bi100.sh deleted file mode 100755 index 2584842..0000000 --- a/run_in_docker_bi100.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /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 diff --git a/run_in_docker_mlu370.sh b/run_in_docker_mlu370.sh deleted file mode 100755 index b76b3df..0000000 --- a/run_in_docker_mlu370.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env bash -# cnmon -image=harbor-contest.4pd.io/zhanghao/diffusers:mlu370-0.2 -device_id=2 -docker run -it -v /root/zhanghao:/workspace -v /mnt:/mnt --device=/dev/cambricon_dev$device_id:/dev/cambricon_dev0 --device=/dev/cambricon_ctl:/dev/cambricon_ctl $image bash diff --git a/run_in_docker_mrv100.sh b/run_in_docker_mrv100.sh deleted file mode 100755 index 11f9cc3..0000000 --- a/run_in_docker_mrv100.sh +++ /dev/null @@ -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 diff --git a/test.py b/test.py deleted file mode 100644 index 9d66c8b..0000000 --- a/test.py +++ /dev/null @@ -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") \ No newline at end of file diff --git a/test.sh b/test.sh deleted file mode 100755 index 7bad55f..0000000 --- a/test.sh +++ /dev/null @@ -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