Update README.md
Browse files
README.md
CHANGED
|
@@ -34,6 +34,36 @@ RCNA MINI is based on the LoRA architecture, which fine-tunes diffusion models u
|
|
| 34 |
- **Architecture**: LoRA applied to diffusion models
|
| 35 |
- **Inference Steps**: 4-step generation
|
| 36 |
- **Output Length**: 4 to 16 seconds
|
|
|
|
|
|
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
## License:
|
| 39 |
This model is licensed under the [MIT License](LICENSE).
|
|
|
|
| 34 |
- **Architecture**: LoRA applied to diffusion models
|
| 35 |
- **Inference Steps**: 4-step generation
|
| 36 |
- **Output Length**: 4 to 16 seconds
|
| 37 |
+
-
|
| 38 |
+
## Using AnimateLCM with Diffusers
|
| 39 |
|
| 40 |
+
```python
|
| 41 |
+
import torch
|
| 42 |
+
from diffusers import AnimateDiffPipeline, LCMScheduler, MotionAdapter, DiffusionPipeline
|
| 43 |
+
from diffusers.utils import export_to_gif
|
| 44 |
+
|
| 45 |
+
# Load AnimateLCM for video generation
|
| 46 |
+
adapter = MotionAdapter.from_pretrained("Binarybardakshat/RCNA_MINI")
|
| 47 |
+
pipe = AnimateDiffPipeline.from_pretrained("emilianJR/epiCRealism", motion_adapter=adapter, torch_dtype=torch.float16)
|
| 48 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config, beta_schedule="linear")
|
| 49 |
+
pipe.load_lora_weights("Binarybardakshat/RCNA_MINI", weight_name="RCNA_LORA_MINI_1.safetensors", adapter_name="lcm-lora")
|
| 50 |
+
pipe.set_adapters(["lcm-lora"], [0.8])
|
| 51 |
+
pipe.enable_vae_slicing()
|
| 52 |
+
pipe.enable_model_cpu_offload()
|
| 53 |
+
|
| 54 |
+
# Generate video using RCNA MINI
|
| 55 |
+
output = pipe(
|
| 56 |
+
prompt="A space rocket with trails of smoke behind it launching into space from the desert, 4k, high resolution",
|
| 57 |
+
negative_prompt="bad quality, worse quality, low resolution",
|
| 58 |
+
num_frames=16,
|
| 59 |
+
guidance_scale=2.0,
|
| 60 |
+
num_inference_steps=6,
|
| 61 |
+
generator=torch.Generator("cpu").manual_seed(0),
|
| 62 |
+
)
|
| 63 |
+
frames = output.frames[0]
|
| 64 |
+
export_to_gif(frames, "animatelcm.gif")
|
| 65 |
+
print("Video and image generation complete!")
|
| 66 |
+
|
| 67 |
+
```
|
| 68 |
## License:
|
| 69 |
This model is licensed under the [MIT License](LICENSE).
|