diff --git a/Dockerfile.r200 b/Dockerfile similarity index 100% rename from Dockerfile.r200 rename to Dockerfile diff --git a/Dockerfile.a100 b/Dockerfile.a100 deleted file mode 100644 index 852ec90..0000000 --- a/Dockerfile.a100 +++ /dev/null @@ -1,8 +0,0 @@ -FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel - -WORKDIR /workspace - -RUN pip install pytorch-lightning opencv-python-headless imageio[ffmpeg] einops datasets==3.2.0 simplejson diffusers==0.34.0 open_clip_torch==2.24.0 sortedcontainers modelscope av==11.0.0 addict -i https://nexus.4pd.io/repository/pypi-all/simple -RUN pip install transformers accelerate -i https://nexus.4pd.io/repository/pypi-all/simple - -COPY . /workspace/ diff --git a/Dockerfile.ascend b/Dockerfile.ascend deleted file mode 100644 index fac49b2..0000000 --- a/Dockerfile.ascend +++ /dev/null @@ -1,9 +0,0 @@ -FROM git.modelhub.org.cn:9443/enginex-ascend/vllm-ascend:v0.10.0rc1 - -WORKDIR /workspace - -RUN pip install diffusers==0.34.0 -RUN pip install imageio[ffmpeg] einops datasets==3.2.0 simplejson addict open_clip_torch==2.24.0 sortedcontainers modelscope==1.28.2 av==11.0.0 pytorch-lightning -COPY . /workspace/ -RUN patch /usr/local/python3.11.13/lib/python3.11/site-packages/modelscope/models/multi_modal/video_synthesis/text_to_video_synthesis_model.py patch.ascend/text_to_video_synthesis_model.py.patch -RUN patch /usr/local/python3.11.13/lib/python3.11/site-packages/modelscope/utils/device.py patch.ascend/device.py.patch diff --git a/Dockerfile.bi100 b/Dockerfile.bi100 deleted file mode 100644 index be3de26..0000000 --- a/Dockerfile.bi100 +++ /dev/null @@ -1,7 +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 - -RUN pip install diffusers==0.34.0 -RUN pip install imageio[ffmpeg] einops datasets==3.2.0 simplejson addict open_clip_torch==2.24.0 sortedcontainers modelscope==1.28.2 av==11.0.0 pytorch-lightning -COPY . /workspace/ diff --git a/Dockerfile.mlu370 b/Dockerfile.mlu370 deleted file mode 100644 index ce7319d..0000000 --- a/Dockerfile.mlu370 +++ /dev/null @@ -1,12 +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 rm -rf /workspace/* -RUN pip install diffusers==0.34.0 -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.mlu/cambricon_pytorch_lightning-2.5.0+mlu0.7.0-py3-none-any.whl diff --git a/README.md b/README.md index 07c54a3..f7e1626 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ docker build -t text2video:v0.1 . ``` ## 测试结果 -| | A100 平均生成时间(秒) | MLU-x4 平均生成时间(秒) | MLU-x8 平均生成时间(秒)| -|------|-------------------------|----------------------------|---------------------------| -| 时间 | 12 | 37 | 45 - +| | A100 平均生成时间(秒) | 昆仑芯R200-8F 平均生成时间(秒) | +|------|-------------------------|----------------------------| +| 时间 | 11 | 50 | diff --git a/clear.sh b/clear.sh deleted file mode 100755 index 34e8c5a..0000000 --- a/clear.sh +++ /dev/null @@ -1,18 +0,0 @@ - -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 -r patch.$device - git rm -r whls.$device -done -git rm diffusers_video.py -git rm iic.py -git rm test_ms.sh - -git mv Dockerfile.$own Dockerfile -git rm clear.sh diff --git a/diffusers_video.py b/diffusers_video.py deleted file mode 100644 index babf2b0..0000000 --- a/diffusers_video.py +++ /dev/null @@ -1,13 +0,0 @@ -import torch -from diffusers import DiffusionPipeline -from diffusers.utils import export_to_video - -model_path = "/mnt/models/AI-ModelScope/text-to-video-ms-1.7b" -pipe = DiffusionPipeline.from_pretrained( - model_path, torch_dtype=torch.float16, variant="fp16" - ) -pipe.enable_model_cpu_offload() # 省显存 -pipe.enable_vae_slicing() - -frames = pipe("Spiderman is surfing", num_frames=16).frames[0] -export_to_video(frames, "output.mp4") # 默认约2秒/8fps diff --git a/iic.py b/iic.py deleted file mode 100644 index b968356..0000000 --- a/iic.py +++ /dev/null @@ -1,16 +0,0 @@ -import os -import torch -device = "cuda" if torch.cuda.is_available() else "npu" -import patch - -from modelscope.pipelines import pipeline -from modelscope.outputs import OutputKeys - -model_path = "/mnt/contest_ceph/zhanghao/models/iic/text-to-video-synthesis" -p = pipeline('text-to-video-synthesis', model_path, device=device) - -test_text = { - 'text': 'A panda eating a burger and french fries on a rock.', - } -output_video_path = p(test_text, device=device, output_video='./output.mp4')[OutputKeys.OUTPUT_VIDEO] -print('output_video_path:', output_video_path) diff --git a/patch.ascend/device.py.patch b/patch.ascend/device.py.patch deleted file mode 100644 index 58c4d32..0000000 --- a/patch.ascend/device.py.patch +++ /dev/null @@ -1,2 +0,0 @@ -27d26 -< assert eles[0] in ['cpu', 'cuda', 'gpu'], err_msg diff --git a/patch.ascend/text_to_video_synthesis_model.py.patch b/patch.ascend/text_to_video_synthesis_model.py.patch deleted file mode 100644 index 693b916..0000000 --- a/patch.ascend/text_to_video_synthesis_model.py.patch +++ /dev/null @@ -1,10 +0,0 @@ -60a61 -> print(f"kwargs: {kwargs}") -62a64 -> print(f"device: {self.device}") -129c131 -< layer='penultimate') ---- -> layer='penultimate', device=self.device) -224a227 -> print(f"self.device: {self.device}") diff --git a/run_in_docker.sh b/run_in_docker.sh index 09445b0..b2b191b 100755 --- a/run_in_docker.sh +++ b/run_in_docker.sh @@ -1,5 +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 +device_id=2 +docker run -v `pwd`:/workspace -v /mnt:/mnt --device=/dev/xpu$device_id:/dev/xpu0 --device=/dev/xpuctrl:/dev/xpuctrl $image bash ./test.sh diff --git a/run_in_docker_a100.sh b/run_in_docker_a100.sh deleted file mode 100755 index 8919057..0000000 --- a/run_in_docker_a100.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env bash -image=harbor-contest.4pd.io/zhanghao/t2v:a100-0.2 -docker run -it -v /home/zhanghao/workspace:/workspace -v /mnt:/mnt $image bash diff --git a/run_in_docker_ascend.sh b/run_in_docker_ascend.sh deleted file mode 100755 index 18c89df..0000000 --- a/run_in_docker_ascend.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -image=harbor-contest.4pd.io/zhanghao/t2v:ascend-0.1 -device=0 -docker run -it -v `pwd`:/host -e ASCEND_VISIBLE_DEVICES=$device --device /dev/davinci$device:/dev/davinci0 --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc -v /mnt:/mnt -v /usr/local/dcmi:/usr/local/dcmi -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info -v /etc/ascend_install.info:/etc/ascend_install.info --privileged --entrypoint bash $image diff --git a/run_in_docker_bi100.sh b/run_in_docker_bi100.sh deleted file mode 100755 index c0ee0eb..0000000 --- a/run_in_docker_bi100.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env bash -image=harbor-contest.4pd.io/zhanghao/t2v:bi100-0.1 -docker run -it -v /data2:/data2 -v /home/zhanghao/workspace:/host -v /mnt:/mnt --device=dev/iluvatar1:/dev/iluvatar0 --device=/dev/iluvatar2:/dev/iluvatar1 $image bash diff --git a/run_in_docker_mlu370.sh b/run_in_docker_mlu370.sh deleted file mode 100755 index 7639d37..0000000 --- a/run_in_docker_mlu370.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash -# cnmon -image=harbor-contest.4pd.io/zhanghao/iic:mlu370 -image=harbor-contest.4pd.io/zhanghao/t2v:mlu370-0.1 -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_r200.sh b/run_in_docker_r200.sh deleted file mode 100755 index cc1d70f..0000000 --- a/run_in_docker_r200.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash -# cnmon -image=harbor-contest.4pd.io/zhanghao/t2v:r200-0.1 -device_id=2 -# docker run -it -v /root/zhanghao:/workspace -v /mnt:/mnt --security-opt=seccomp=unconfined --cap-add=SYS_PTRACE --cap-add=SYS_ADMIN --device /dev/fuse --shm-size=32g --ulimit=memlock=-1 --ulimit=nofile=120000 --ulimit=stack=67108864 --device=/dev/xpu$device_id:/dev/xpu0 --device=/dev/xpuctrl:/dev/xpuctrl $image bash -docker run -it -v /root/zhanghao:/workspace -v /mnt:/mnt --device=/dev/xpu$device_id:/dev/xpu0 --device=/dev/xpuctrl:/dev/xpuctrl $image bash diff --git a/test_ms.sh b/test_ms.sh deleted file mode 100755 index 34a63a4..0000000 --- a/test_ms.sh +++ /dev/null @@ -1 +0,0 @@ -python3 main.py --model "/mnt/models/AI-ModelScope/text-to-video-ms-1.7b" --json "dataset.json" --results "results.json" --outdir "output" --device cuda --dtype fp16 --model_type "text-to-video-ms" \ No newline at end of file diff --git a/whls.mlu370/cambricon_pytorch_lightning-2.5.0+mlu0.7.0-py3-none-any.whl b/whls.mlu370/cambricon_pytorch_lightning-2.5.0+mlu0.7.0-py3-none-any.whl deleted file mode 100644 index 93593cc..0000000 --- a/whls.mlu370/cambricon_pytorch_lightning-2.5.0+mlu0.7.0-py3-none-any.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:281f8517b0798e664057194d158f6810b430db2265c660a0200addb1c1179251 -size 1631044