Skip to content

Commit 1b0ccef

Browse files
authored
Update README.md
1 parent 6392f61 commit 1b0ccef

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,51 @@ $cdebug20251007-080500: exit
5555
PS C:\Users\原神\Desktop>
5656
```
5757

58-
# Code
58+
# Example
59+
```py
60+
import os, time
61+
62+
######################################################################################################################
63+
print("import torch")
64+
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
65+
66+
import torch
67+
from diffusers import AutoencoderKLCogVideoX, CogVideoXImageToVideoPipeline, CogVideoXTransformer3DModel
68+
from diffusers.utils import export_to_video, load_image
69+
from transformers import T5EncoderModel
70+
71+
"""#### Load models and create pipeline
72+
73+
Note: `bfloat16`, which is the recommended dtype for running "CogVideoX-5b-I2V" will cause OOM errors due to lack of efficient support on Turing GPUs.
74+
75+
Therefore, we must use `float16`, which might result in poorer generation quality. The recommended solution is to use Ampere or above GPUs, which also support efficient quantization kernels from [TorchAO](https://github.com/pytorch/ao) :(
76+
"""
77+
78+
# model_id = "THUDM/CogVideoX-5b-I2V"
79+
80+
##!!!!!!!REMBER USE r"",NOT ""!!!!!!!!!!!!!!!
81+
##WILL CAUSE BUG!!!!!!!!!!##########
82+
83+
path = r"D:\2\hub\models--THUDM--CogVideoX-5b-I2V\snapshots\a6f0f4858a8395e7429d82493864ce92bf73af11"
84+
85+
print("Load Model")
86+
87+
print("transformer")
88+
transformer = CogVideoXTransformer3DModel.from_pretrained(path, subfolder="transformer", torch_dtype=torch.float16)
89+
print("text_encoder")
90+
text_encoder = T5EncoderModel.from_pretrained(path, subfolder="text_encoder", torch_dtype=torch.float16)
91+
print("vae")
92+
vae = AutoencoderKLCogVideoX.from_pretrained(path, subfolder="vae", torch_dtype=torch.float16)
93+
94+
print("START THE SHELL... Begin INTO DEBUG MODE....")
95+
######################################################################################################################
96+
97+
import cdebug
98+
99+
cdebug.main(globals())
100+
```
101+
102+
# Old_Code
59103
```py
60104
import os, time
61105

@@ -77,7 +121,7 @@ while 1:
77121
print(e)
78122
```
79123

80-
# Example
124+
# Old_Example
81125
```py
82126
import os, time
83127

0 commit comments

Comments
 (0)