TheDenk
commited on
Commit
•
99db593
1
Parent(s):
1a1ee3a
base
Browse files- README.md +68 -0
- pytorch_lora_weights.safetensors +3 -0
README.md
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- cogvideox
|
7 |
+
- video-generation
|
8 |
+
- video-to-video
|
9 |
+
- diffusers
|
10 |
+
---
|
11 |
+
|
12 |
+
# CogvideoX-5b LoRa to control camera movement
|
13 |
+
|
14 |
+
The LoRa was trained to control camera movement in 6 directions: `left`, `right`, `up`, `down`, `zoom_in`, `zoom_out`.
|
15 |
+
Start prompt with text like this:
|
16 |
+
```python
|
17 |
+
'Сamera moves to the {}...',
|
18 |
+
'Сamera is moving to the {}...',
|
19 |
+
'{} camera movement...',
|
20 |
+
'{} camera turn...',
|
21 |
+
```
|
22 |
+
|
23 |
+
### Inference examples
|
24 |
+
#### Minimal code example
|
25 |
+
```python
|
26 |
+
import torch
|
27 |
+
from diffusers import CogVideoXImageToVideoPipeline
|
28 |
+
from diffusers.utils import export_to_video, load_image
|
29 |
+
|
30 |
+
|
31 |
+
pipe = CogVideoXImageToVideoPipeline.from_pretrained(
|
32 |
+
"THUDM/CogVideoX1.5-5B-I2V", torch_dtype=torch.bfloat16
|
33 |
+
)
|
34 |
+
|
35 |
+
pipe.load_lora_weights("NimVideo/cogvideox1.5-5b-prompt-camera-motion", adapter_name="cogvideox-lora")
|
36 |
+
pipe.set_adapters(["cogvideox-lora"], [1.0])
|
37 |
+
|
38 |
+
pipe.enable_sequential_cpu_offload()
|
39 |
+
pipe.vae.enable_slicing()
|
40 |
+
pipe.vae.enable_tiling()
|
41 |
+
|
42 |
+
height = 768
|
43 |
+
width = 1360
|
44 |
+
image = load_image("resources/car.jpg").resize((width, height))
|
45 |
+
prompt = "Camera is moving to the left. A red sports car driving on a winding road."
|
46 |
+
|
47 |
+
video_generate = pipe(
|
48 |
+
image=image,
|
49 |
+
prompt=prompt,
|
50 |
+
height=height,
|
51 |
+
width=width,
|
52 |
+
num_inference_steps=50,
|
53 |
+
num_frames=81,
|
54 |
+
guidance_scale=6.0,
|
55 |
+
generator=torch.Generator().manual_seed(42),
|
56 |
+
).frames[0]
|
57 |
+
|
58 |
+
export_to_video(video_generate, output_path, fps=8)
|
59 |
+
```
|
60 |
+
|
61 |
+
#### Inference with cli and jupyter-notebook examlple you can find <a href="https://github.com/Nim-Video/cogvideox1.5-5b-prompt-camera-motion">on our Github</a>
|
62 |
+
|
63 |
+
|
64 |
+
## Acknowledgements
|
65 |
+
Original code and models [CogVideoX](https://github.com/THUDM/CogVideo/tree/main).
|
66 |
+
|
67 |
+
## Contacts
|
68 |
+
<p>Issues should be raised directly in the repository.</p>
|
pytorch_lora_weights.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3fc46d168924f122468bfd8d3dea8b084a8f51b92a3973df54ab8823edc44bf
|
3 |
+
size 264286184
|