From aead975ce4e0f757fe2adbab01d04b31d1716ce4 Mon Sep 17 00:00:00 2001 From: ZHANG Hao Date: Tue, 9 Sep 2025 11:41:59 +0800 Subject: [PATCH] add run_in_docker --- Dockerfile.mlu | 2 +- README.md | 23 +++++++++++++++++++++++ clear.sh | 16 ++++++++++++++++ dataset.json | 6 +++--- run_in_docker.sh | 5 +++++ 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 README.md create mode 100644 clear.sh create mode 100755 run_in_docker.sh diff --git a/Dockerfile.mlu b/Dockerfile.mlu index 788a54c..ce7319d 100644 --- a/Dockerfile.mlu +++ b/Dockerfile.mlu @@ -9,4 +9,4 @@ RUN pip install open_clip_torch==2.24.0 sortedcontainers modelscope av==11.0.0 RUN sed -i 's|source /torch/venv3/pytorch/bin/activate|source /torch/venv3/pytorch_infer/bin/activate|' /root/.bashrc COPY . /workspace/ -RUN pip install whls/cambricon_pytorch_lightning-2.5.0+mlu0.7.0-py3-none-any.whl +RUN pip install whls.mlu/cambricon_pytorch_lightning-2.5.0+mlu0.7.0-py3-none-any.whl diff --git a/README.md b/README.md new file mode 100644 index 0000000..07c54a3 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +## Quickstart + +### 构建镜像 +```bash +docker build -t text2video:v0.1 . +``` + +### 模型下载 +模型地址:https://modelscope.cn/models/iic/text-to-video-synthesis +并放到目录:`/mnt/contest_ceph/zhanghao/models/iic/text-to-video-synthesis`(如更改目录,请修改后面的执行脚本中的模型路径) + +### 测试程序 +1. 准备输入数据集,可以参考示例`dataset.json` +2. 在docker镜像里运行测试程序,会根据`dataset.json`内容,在`output`目录下生成视频文件。 +```bash +./run_in_docker.sh +``` + +## 测试结果 +| | A100 平均生成时间(秒) | MLU-x4 平均生成时间(秒) | MLU-x8 平均生成时间(秒)| +|------|-------------------------|----------------------------|---------------------------| +| 时间 | 12 | 37 | 45 + diff --git a/clear.sh b/clear.sh new file mode 100644 index 0000000..d9c199d --- /dev/null +++ b/clear.sh @@ -0,0 +1,16 @@ + +own=mlu370 +for device in a100 ascend bi100 mlu370 r200 +do + git rm run_in_docker_"$device".sh + if [[ $device == $own ]]; then + continue + fi + git rm Dockerfile.$device + git rm patch.$device +done +git rm diffusers_video.py +git rm iic.py +git rm test_ms.sh + +git mv Dockerfile.$own Dockerfile diff --git a/dataset.json b/dataset.json index 135bd87..4c9d9f4 100644 --- a/dataset.json +++ b/dataset.json @@ -1,4 +1,4 @@ [ - "An image of a squirrel in Picasso style", - "A cozy cabin in the woods, watercolor painting" -] \ No newline at end of file + "A panda is eating burgers and french fries", + "A sheep is walking and eating in the grass" +] diff --git a/run_in_docker.sh b/run_in_docker.sh new file mode 100755 index 0000000..09445b0 --- /dev/null +++ b/run_in_docker.sh @@ -0,0 +1,5 @@ +#! /usr/bin/env bash +# cnmon +image=text2video:v0.1 +device_id=0 +docker run -v `pwd`:/workspace -v /mnt:/mnt --device=/dev/cambricon_dev$device_id:/dev/cambricon_dev0 --device=/dev/cambricon_ctl:/dev/cambricon_ctl $image ./test.sh