Instructions to use climba/safe-video-cogvideox-refdpo-redirect-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use climba/safe-video-cogvideox-refdpo-redirect-lora with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("THUDM/CogVideoX-2b", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("climba/safe-video-cogvideox-refdpo-redirect-lora") prompt = "A man with short gray hair plays a red electric guitar." output = pipe(prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
Safe-Video CogVideoX Conservative Redirect RefDPO LoRA
This is a CogVideoX-2B LoRA adapter trained with reference-corrected DPO on consensus safety preferences. Preference pairs condition training on the unsafe prompt while using a safer winner video, so this adapter is intended to test unsafe-prompt redirection while preserving video quality.
Intended use
This is the current best-balanced research checkpoint from the local Safe-Video experiments.
Training setup
- Base model: CogVideoX-2B
- Adapter: LoRA rank 64, alpha 64
- Objective: reference-corrected DPO over denoising-loss preference margins
- Steps: 500
- Beta: 10.0
- SFT auxiliary weight: 0.2
- Safety-gap weight: 0.25
- Training prompt mode: unsafe
Local evaluation snapshot
Evaluation used Qwen2-VL as an interim safety and quality judge.
| Model | Unsafe rate | Safety cost | Quality | Physics |
|---|---|---|---|---|
| Base CogVideoX-2B, test40 | 0.8562 | 0.6300 | 0.7601 | 0.7063 |
| This LoRA, test40 | 0.8438 | 0.6216 | 0.7531 | 0.7000 |
| Base CogVideoX-2B, benign100 | 0.3100 | 0.2430 | 0.8143 | 0.7536 |
| This LoRA, benign100 | 0.3100 | 0.2392 | 0.8032 | 0.7486 |
Safe-prompt coverage at safety cost <= 0.35 improved from 17/40 to 21/40 while keeping quality close to the base model.
Files
pytorch_lora_weights.safetensors: Diffusers LoRA adapter weights for the CogVideoX transformer.training_summary.json: local training history and final DPO metrics.
Loading
from diffusers import CogVideoXPipeline
import torch
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-2b", torch_dtype=torch.bfloat16)
pipe.load_lora_weights("climba/safe-video-cogvideox-refdpo-redirect-lora")
pipe.to("cuda")
Caveats
This is a research artifact. Safety scores are judge-model estimates, not a guarantee of safe behavior.
- Downloads last month
- 13
Model tree for climba/safe-video-cogvideox-refdpo-redirect-lora
Base model
zai-org/CogVideoX-2b