FangSen9000 Claude commited on
Commit ·
6b0f4c6
1
Parent(s): 2f8d0cb
Add optimized ControlNeXt-SVD-v2 implementation with direct pose input support
Browse filesMajor improvements:
- Add run_controlnext_optimized.py with FP16 support, xformers, and GEGLU optimization
- Add direct pose video/images input to bypass DWPose extraction
- Implement smart output naming based on input filename
- Add ComfyUI-ControlNeXt-SVD reference implementation for analysis
- Update README with optimized inference examples
- Add easy_dwpose integration for pose extraction
- Generate example pose videos with text2pose system
Performance optimizations:
- Default FP16 precision for faster inference
- Memory-efficient attention with xformers
- Chunked VAE decoding to reduce memory usage
- GEGLU inplace operations for memory savings
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Files changed (23)
- ControlNeXt-SVD-v2/git_push2.logDeleted-15
- ControlNeXt-SVD-v2/run_controlnext_optimized.pyAdded+383
- ControlNeXt-SVD-v2/utils/__pycache__/pre_process_direct.cpython-310.pycAdded
- ControlNeXt-SVD-v2/utils/pre_process_direct.pyAdded+182
- README.md+16-28
- easy_dwpose/__pycache__/__init__.cpython-310.pycAdded
- easy_dwpose/__pycache__/dwpose.cpython-310.pycAdded
- easy_dwpose/body_estimation/__pycache__/__init__.cpython-310.pycAdded
- easy_dwpose/body_estimation/__pycache__/detector.cpython-310.pycAdded
- easy_dwpose/body_estimation/__pycache__/pose.cpython-310.pycAdded
- easy_dwpose/body_estimation/__pycache__/utils.cpython-310.pycAdded
- easy_dwpose/body_estimation/__pycache__/wholebody.cpython-310.pycAdded
- easy_dwpose/draw/__pycache__/__init__.cpython-310.pycAdded
- easy_dwpose/draw/__pycache__/controlnext.cpython-310.pycAdded
- easy_dwpose/draw/__pycache__/openpose.cpython-310.pycAdded
- generated_pose_video/GOOD_AFTERNOON_25073_01435_20250803_222800.mp4Added+3
- generated_sign_video/output.mp4+2-2
- generated_sign_video/test_1.mp4+2-2
- generated_sign_video_direct/GOOD_AFTERNOON_25073_01435_20250803_222800.mp4Added+3
- generated_sign_video_direct/GOOD_AFTERNOON_25073_01435_20250803_222800_combined.mp4Added+3
- useless/abandon_cmd.mdAdded+64
- ControlNeXt-SVD-v2/run_controlnext.py → useless/run_controlnext_v1(无优化.pyRenamed
- useless/run_with_pose_video.shAdded+59
123456789101112131415Uploading LFS objects: 100% (25/25), 6.2 GB | 0 B/s, done.remote: [31m-------------------------------------------------------------------------[0m remote: [31mYour push was rejected because it contains binary files.[0m remote: [31mPlease use https://git-lfs.github.com/ to store binary files.[0m remote: [31mSee also: https://hf.co/docs/hub/repositories-getting-started#terminal[0m remote: [31m[0m remote: [31mOffending files:[0m remote: [31m - ref_img_dict/01.jpeg (ref: refs/heads/main)[0m remote: [31m - ref_img_dict/02.jpeg (ref: refs/heads/main)[0m remote: [31m - ref_img_dict/03.jpeg (ref: refs/heads/main)[0m remote: [31m - ref_img_dict/04.jpeg (ref: refs/heads/main)[0m remote: [31m-------------------------------------------------------------------------[0m To hf.co:datasets/FangSen9000/StableSigner ! [remote rejected] main -> main (pre-receive hook declined)error: failed to push some refs to 'hf.co:datasets/FangSen9000/StableSigner'123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383import osimport torchimport numpy as npfrom PIL import Imagefrom pipeline.pipeline_stable_video_diffusion_controlnext import StableVideoDiffusionPipelineControlNeXtfrom models.controlnext_vid_svd import ControlNeXtSDVModelfrom models.unet_spatio_temporal_condition_controlnext import UNetSpatioTemporalConditionControlNeXtModelfrom transformers import CLIPVisionModelWithProjectionimport re from diffusers import AutoencoderKLTemporalDecoderfrom moviepy.editor import ImageSequenceClipfrom decord import VideoReaderimport argparsefrom safetensors.torch import load_filefrom utils.pre_process import preprocessfrom utils.pre_process_direct import preprocess_direct_pose, load_pose_from_imagesimport gc
# Patch GEGLU for memory optimizationtry: import diffusers.models.activations def patch_geglu_inplace(): """Patch GEGLU with inplace multiplication to save GPU memory.""" def forward(self, hidden_states): hidden_states, gate = self.proj(hidden_states).chunk(2, dim=-1) return hidden_states.mul_(self.gelu(gate)) diffusers.models.activations.GEGLU.forward = forward patch_geglu_inplace() print("✓ GEGLU optimization applied")except: pass
def write_mp4(video_path, samples, fps=14, audio_bitrate="192k"): clip = ImageSequenceClip(samples, fps=fps) clip.write_videofile(video_path, audio_codec="aac", audio_bitrate=audio_bitrate, ffmpeg_params=["-crf", "18", "-preset", "slow"])
def save_vid_side_by_side(batch_output, validation_control_images, output_folder, fps, base_filename="output"): # Helper function to convert tensors to PIL images and save as GIF flattened_batch_output = [img for sublist in batch_output for img in sublist] # Use base filename for the output files video_path = os.path.join(output_folder, f'{base_filename}_combined.mp4') final_images = [] outputs = [] # Helper function to concatenate images horizontally def get_concat_h(im1, im2): dst = Image.new('RGB', (im1.width + im2.width, max(im1.height, im2.height))) dst.paste(im1, (0, 0)) dst.paste(im2, (im1.width, 0)) return dst for image_list in zip(validation_control_images, flattened_batch_output): predict_img = image_list[1].resize(image_list[0].size) result = get_concat_h(image_list[0], predict_img) final_images.append(np.array(result)) outputs.append(np.array(predict_img)) write_mp4(video_path, final_images, fps=fps)
output_path = os.path.join(output_folder, f'{base_filename}.mp4') write_mp4(output_path, outputs, fps=fps)
def load_tensor(tensor_path): if os.path.splitext(tensor_path)[1] == '.bin': return torch.load(tensor_path) elif os.path.splitext(tensor_path)[1] == ".safetensors": return load_file(tensor_path) else: print("without supported tensors") os._exit()
def parse_args(): parser = argparse.ArgumentParser( description="Script to train Stable Diffusion XL for InstructPix2Pix." )
parser.add_argument( "--pretrained_model_name_or_path", type=str, default=None, required=True )
parser.add_argument( "--validation_control_video_path", type=str, default=None, required=False, ) parser.add_argument( "--pose_video_path", type=str, default=None, help="Path to pre-extracted pose video (bypass DWPose)" ) parser.add_argument( "--pose_images_dir", type=str, default=None, help="Directory containing pose images (bypass DWPose)" )
parser.add_argument( "--output_dir", type=str, default=None, required=True )
parser.add_argument( "--height", type=int, default=768, required=False )
parser.add_argument( "--width", type=int, default=512, required=False )
parser.add_argument( "--guidance_scale", type=float, default=2., required=False )
parser.add_argument( "--num_inference_steps", type=int, default=25, required=False )
parser.add_argument( "--controlnext_path", type=str, default=None, required=True )
parser.add_argument( "--unet_path", type=str, default=None, required=True ) parser.add_argument( "--max_frame_num", type=int, default=50, required=False )
parser.add_argument( "--ref_image_path", type=str, default=None, required=True )
parser.add_argument( "--batch_frames", type=int, default=14, required=False )
parser.add_argument( "--overlap", type=int, default=4, required=False )
parser.add_argument( "--sample_stride", type=int, default=2, required=False )
parser.add_argument( "--precision", type=str, default="fp16", choices=["fp32", "fp16", "bf16"], help="Model precision" )
parser.add_argument( "--enable_xformers", action="store_true", help="Enable xformers memory efficient attention" )
parser.add_argument( "--decode_chunk_size", type=int, default=2, help="Chunk size for VAE decoding" )
args = parser.parse_args() return args
# Main scriptif __name__ == "__main__": args = parse_args()
# Set precision dtype_map = { "fp32": torch.float32, "fp16": torch.float16, "bf16": torch.bfloat16 } dtype = dtype_map[args.precision] print(f"🚀 Using precision: {args.precision}") # Clear GPU cache if torch.cuda.is_available(): torch.cuda.empty_cache() gc.collect()
# Load models with optimizations print("📦 Loading UNet...") unet = UNetSpatioTemporalConditionControlNeXtModel.from_pretrained( args.pretrained_model_name_or_path, subfolder="unet", low_cpu_mem_usage=True, torch_dtype=dtype, ) print("📦 Loading ControlNeXt...") controlnext = ControlNeXtSDVModel() controlnext.load_state_dict(load_tensor(args.controlnext_path)) controlnext = controlnext.to(dtype) # Load UNet weights print("📦 Loading UNet weights...") unet.load_state_dict(load_tensor(args.unet_path), strict=False)
print("📦 Loading other components...") image_encoder = CLIPVisionModelWithProjection.from_pretrained( args.pretrained_model_name_or_path, subfolder="image_encoder", torch_dtype=dtype, low_cpu_mem_usage=True, ) vae = AutoencoderKLTemporalDecoder.from_pretrained( args.pretrained_model_name_or_path, subfolder="vae", torch_dtype=dtype, low_cpu_mem_usage=True, ) # Create pipeline pipeline = StableVideoDiffusionPipelineControlNeXt.from_pretrained( args.pretrained_model_name_or_path, controlnext=controlnext, unet=unet, vae=vae, image_encoder=image_encoder, torch_dtype=dtype, ) # Enable optimizations if args.enable_xformers: try: pipeline.enable_xformers_memory_efficient_attention() print("✓ Xformers memory efficient attention enabled") except: print("⚠️ Xformers not available, using default attention") # Enable model CPU offload for memory efficiency pipeline.enable_model_cpu_offload() # Optional: Enable VAE slicing for lower memory usage # pipeline.enable_vae_slicing() # Optional: Enable VAE tiling for very large images # pipeline.enable_vae_tiling()
os.makedirs(args.output_dir, exist_ok=True)
# Choose preprocessing method based on input if args.pose_video_path: print("🎬 Loading pre-extracted pose video...") validation_control_images, ref_image = preprocess_direct_pose( args.pose_video_path, args.ref_image_path, width=args.width, height=args.height, max_frame_num=args.max_frame_num, sample_stride=args.sample_stride ) elif args.pose_images_dir: print("🎬 Loading pose images from directory...") validation_control_images, ref_image = load_pose_from_images( args.pose_images_dir, args.ref_image_path, width=args.width, height=args.height, max_frame_num=args.max_frame_num, sample_stride=args.sample_stride ) else: print("🎬 Preprocessing video with DWPose extraction...") validation_control_images, ref_image = preprocess( args.validation_control_video_path, args.ref_image_path, width=args.width, height=args.height, max_frame_num=args.max_frame_num, sample_stride=args.sample_stride )
final_result = [] frames = args.batch_frames num_frames = min(args.max_frame_num, len(validation_control_images))
for i in range(num_frames): validation_control_images[i] = Image.fromarray(np.array(validation_control_images[i])) print(f"🎯 Generating {num_frames} frames...") # Run inference with optimizations video_frames = pipeline( ref_image, validation_control_images[:num_frames], decode_chunk_size=args.decode_chunk_size, # Chunked decoding num_frames=num_frames, motion_bucket_id=127.0, fps=7, controlnext_cond_scale=1.0, width=args.width, height=args.height, min_guidance_scale=args.guidance_scale, max_guidance_scale=args.guidance_scale, frames_per_batch=frames, num_inference_steps=args.num_inference_steps, overlap=args.overlap ).frames[0] final_result.append(video_frames)
# Determine FPS based on input type if args.pose_video_path: fps = VideoReader(args.pose_video_path).get_avg_fps() // args.sample_stride # Extract base filename from pose video path base_filename = os.path.splitext(os.path.basename(args.pose_video_path))[0] elif args.pose_images_dir: fps = 30 // args.sample_stride # Default FPS for image sequences # Use directory name as base filename base_filename = os.path.basename(args.pose_images_dir.rstrip('/')) else: fps = VideoReader(args.validation_control_video_path).get_avg_fps() // args.sample_stride # Extract base filename from control video path base_filename = os.path.splitext(os.path.basename(args.validation_control_video_path))[0] print("💾 Saving results...") save_vid_side_by_side( final_result, validation_control_images[:num_frames], args.output_dir, fps=fps, base_filename=base_filename ) print(f"✅ Done! Output saved as:") print(f" - {os.path.join(args.output_dir, base_filename + '.mp4')}") print(f" - {os.path.join(args.output_dir, base_filename + '_combined.mp4')}")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182import osimport argparseimport loggingimport mathfrom omegaconf import OmegaConffrom datetime import datetimefrom pathlib import Pathfrom PIL import Imageimport numpy as npimport torch.jitfrom torchvision.datasets.folder import pil_loaderfrom torchvision.transforms.functional import pil_to_tensor, resize, center_cropfrom torchvision.transforms.functional import to_pil_imagefrom dwpose.preprocess import get_image_pose, get_video_poseimport cv2
ASPECT_RATIO = 9 / 16
def preprocess(video_path, image_path, width=576, height=1024, sample_stride=2, max_frame_num=None): """preprocess ref image pose and video pose
Args: video_path (str): input video pose path image_path (str): reference image path resolution (int, optional): Defaults to 576. sample_stride (int, optional): Defaults to 2. """ image_pixels = pil_loader(image_path) image_pixels = pil_to_tensor(image_pixels) # (c, h, w) h, w = image_pixels.shape[-2:] ############################ compute target h/w according to original aspect ratio ############################### # if h>w: # w_target, h_target = resolution, int(resolution / ASPECT_RATIO // 64) * 64 # else: # w_target, h_target = int(resolution / ASPECT_RATIO // 64) * 64, resolution w_target, h_target = width, height h_w_ratio = float(h) / float(w) if h_w_ratio < h_target / w_target: h_resize, w_resize = h_target, math.ceil(h_target / h_w_ratio) else: h_resize, w_resize = math.ceil(w_target * h_w_ratio), w_target image_pixels = resize(image_pixels, [h_resize, w_resize], antialias=None) image_pixels = center_crop(image_pixels, [h_target, w_target]) image_pixels = image_pixels.permute((1, 2, 0)).numpy() ##################################### get image&video pose value ################################################# image_pose = get_image_pose(image_pixels) video_pose = get_video_pose(video_path, image_pixels, sample_stride=sample_stride, max_frame_num=max_frame_num) pose_pixels = np.concatenate([np.expand_dims(image_pose, 0), video_pose]) # image_pixels = np.transpose(np.expand_dims(image_pixels, 0), (0, 3, 1, 2)) image_pixels = Image.fromarray(image_pixels) pose_pixels = [Image.fromarray(p.transpose((1,2,0))) for p in pose_pixels] # return torch.from_numpy(pose_pixels.copy()) / 127.5 - 1, torch.from_numpy(image_pixels) / 127.5 - 1 return pose_pixels, image_pixels
def preprocess_direct_pose(pose_video_path, image_path, width=576, height=1024, sample_stride=2, max_frame_num=None): """Preprocess with pre-extracted pose video (bypass DWPose extraction) Args: pose_video_path (str): Path to pre-extracted pose video (MP4 with pose skeleton) image_path (str): reference image path width (int): target width height (int): target height sample_stride (int): frame sampling stride max_frame_num (int): maximum number of frames to process """ # Process reference image image_pixels = pil_loader(image_path) image_pixels = pil_to_tensor(image_pixels) # (c, h, w) h, w = image_pixels.shape[-2:] w_target, h_target = width, height h_w_ratio = float(h) / float(w) if h_w_ratio < h_target / w_target: h_resize, w_resize = h_target, math.ceil(h_target / h_w_ratio) else: h_resize, w_resize = math.ceil(w_target * h_w_ratio), w_target image_pixels = resize(image_pixels, [h_resize, w_resize], antialias=None) image_pixels = center_crop(image_pixels, [h_target, w_target]) image_pixels = image_pixels.permute((1, 2, 0)).numpy() # Get pose for reference image image_pose = get_image_pose(image_pixels) # Load pre-extracted pose video cap = cv2.VideoCapture(pose_video_path) pose_frames = [] frame_count = 0 while True: ret, frame = cap.read() if not ret: break # Apply sample stride if frame_count % sample_stride == 0: # Convert BGR to RGB frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) # Resize frame to target size if needed if frame_rgb.shape[:2] != (h_target, w_target): frame_rgb = cv2.resize(frame_rgb, (w_target, h_target)) pose_frames.append(frame_rgb) # Check max frame limit if max_frame_num is not None and len(pose_frames) >= max_frame_num: break frame_count += 1 cap.release() # Convert to numpy array and prepare output video_pose = np.array(pose_frames).transpose((0, 3, 1, 2)) # (n, c, h, w) pose_pixels = np.concatenate([np.expand_dims(image_pose, 0), video_pose]) # Convert to PIL Images image_pixels = Image.fromarray(image_pixels) pose_pixels = [Image.fromarray(p.transpose((1,2,0))) for p in pose_pixels] return pose_pixels, image_pixels
def load_pose_from_images(pose_images_dir, image_path, width=576, height=1024, sample_stride=1, max_frame_num=None): """Load pose from a directory of pose images Args: pose_images_dir (str): Directory containing pose images (PNG/JPG files) image_path (str): reference image path width (int): target width height (int): target height sample_stride (int): frame sampling stride (1 means use all frames) max_frame_num (int): maximum number of frames to process """ # Process reference image image_pixels = pil_loader(image_path) image_pixels = pil_to_tensor(image_pixels) # (c, h, w) h, w = image_pixels.shape[-2:] w_target, h_target = width, height h_w_ratio = float(h) / float(w) if h_w_ratio < h_target / w_target: h_resize, w_resize = h_target, math.ceil(h_target / h_w_ratio) else: h_resize, w_resize = math.ceil(w_target * h_w_ratio), w_target image_pixels = resize(image_pixels, [h_resize, w_resize], antialias=None) image_pixels = center_crop(image_pixels, [h_target, w_target]) image_pixels = image_pixels.permute((1, 2, 0)).numpy() # Get pose for reference image image_pose = get_image_pose(image_pixels) # Load pose images from directory pose_files = sorted([f for f in os.listdir(pose_images_dir) if f.lower().endswith(('.png', '.jpg', '.jpeg'))]) pose_frames = [] for i, pose_file in enumerate(pose_files): if i % sample_stride == 0: pose_path = os.path.join(pose_images_dir, pose_file) pose_img = Image.open(pose_path).convert('RGB') # Resize if needed if pose_img.size != (w_target, h_target): pose_img = pose_img.resize((w_target, h_target), Image.LANCZOS) pose_frames.append(np.array(pose_img)) # Check max frame limit if max_frame_num is not None and len(pose_frames) >= max_frame_num: break # Convert to numpy array video_pose = np.array(pose_frames).transpose((0, 3, 1, 2)) # (n, c, h, w) pose_pixels = np.concatenate([np.expand_dims(image_pose, 0), video_pose]) # Convert to PIL Images image_pixels = Image.fromarray(image_pixels) pose_pixels = [Image.fromarray(p.transpose((1,2,0))) for p in pose_pixels] return pose_pixels, image_pixels5 unmodified lines6789101121 unmodified lines3334353637381 unmodified line404142434445464 unmodified lines5152535455565758593 unmodified lines6364656667686970717273747576777879808182838485868788899091925 unmodified lines- In the pose2video section, we render the visualized poses of the skeletons generated by each word. I used the ControlNext-SVD model for this.# For developers1. git clone https://huggingface.co/datasets/FangSen9000/StableSigner21 unmodified lines## tutorial02 get pose video from text input```python# Single glosspython text2pose.py --gloss "hello"1 unmodified linepython text2pose.py --gloss "hello world" --smoothing fade --smoothing-frames 5# Custom video parameterspython text2pose.py --gloss "afternoon" --width 640 --height 480 --fps 25```## tutorial03 render pose video4 unmodified lines4. run `pip install -r env/requirements02_controlnext.txt````pythonCUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext.py \--pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \--output_dir generated_sign_video \--max_frame_num 240 \--guidance_scale 3 \--batch_frames 24 \3 unmodified lines--width 512 \--controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \--unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \--validation_control_video_path ControlNeXt-SVD-v2/examples/video/02.mp4 \--ref_image_path ref_img_dict/03.jpeg```<!-- official```pythonCUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext.py \--pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \--output_dir generated_sign_video \--max_frame_num 240 \--guidance_scale 3 \--batch_frames 24 \--sample_stride 2 \--overlap 6 \--height 1024 \--width 576 \--controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \--unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \--validation_control_video_path ControlNeXt-SVD-v2/examples/video/02.mp4 \--ref_image_path ControlNeXt-SVD-v2/examples/ref_imgs/01.jpeg```--># For Users## start00 just start as a user5 unmodified lines678910111213141521 unmodified lines373839404142434445461 unmodified line484950515253544 unmodified lines5960616263646566673 unmodified lines717273747576777879805 unmodified lines- In the pose2video section, we render the visualized poses of the skeletons generated by each word. I used the ControlNext-SVD model for this.# For Users# For developers1. git clone https://huggingface.co/datasets/FangSen9000/StableSigner21 unmodified lines## tutorial02 get pose video from text input```python# Defaultpython text2pose.py --gloss "good afternoon" --smoothing fade --smoothing-frames 5 --width 512 --height 768 --fps 30# Single glosspython text2pose.py --gloss "hello"1 unmodified linepython text2pose.py --gloss "hello world" --smoothing fade --smoothing-frames 5# Custom video parameterspython text2pose.py --gloss "good afternoon" --width 512 --height 768 --fps 30```## tutorial03 render pose video4 unmodified lines4. run `pip install -r env/requirements02_controlnext.txt````pythonCUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \--pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \--output_dir generated_sign_video_direct \--max_frame_num 240 \--guidance_scale 3 \--batch_frames 24 \3 unmodified lines--width 512 \--controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \--unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \--pose_video_path generated_pose_video/GOOD_AFTERNOON_25073_01435_20250803_222800.mp4 \--ref_image_path ref_img_dict/03.jpeg \--precision fp16 \--enable_xformers \--decode_chunk_size 2```
123version https://git-lfs.github.com/spec/v1oid sha256:c09157720812d8c72b29fd76b701f60434ba1e5299aaec2054aa49f5fd97495asize 1003827123version https://git-lfs.github.com/spec/v1oid sha256:cd8e1c631af4113c8fe07bc7a64edccd5885c2b6e507ab89c3b369742dc8ab5dsize 3325227123version https://git-lfs.github.com/spec/v1oid sha256:ccdd0d86c5a15ceded93ed45c5c7c5d224edb54292537430c5707760f64e72f5size 1608860
123version https://git-lfs.github.com/spec/v1oid sha256:0f74ca31c3ba3b11394f750e90611dd1f68982d5e68b4ada62aa22767528bf38size 4044690123version https://git-lfs.github.com/spec/v1oid sha256:2c15c4d8ceaa750251f5247a29610a1b02678fa3d1a17ebc51385a7ebc545c8bsize 2229479
123version https://git-lfs.github.com/spec/v1oid sha256:03ae3f09974b40e1aa8e74feb86b8712060537b8eb69bd24344b5104f4d406fesize 585379123version https://git-lfs.github.com/spec/v1oid sha256:04d3f48926a2e3b26889f47d176d7a68c157bdb8f17ae9800b19146e3bda3507size 81575412345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364<!--cd code/StableSigner3
```python 有优化,但是不支持直接以pose video作为输入CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \ --pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \ --output_dir generated_sign_video \ --max_frame_num 240 \ --guidance_scale 3 \ --batch_frames 24 \ --sample_stride 2 \ --overlap 4 \ --height 768 \ --width 512 \ --controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \ --unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \ --validation_control_video_path ControlNeXt-SVD-v2/examples/video/02.mp4 \ --ref_image_path ref_img_dict/03.jpeg \ --precision fp16 \ --enable_xformers \ --decode_chunk_size 2```-->
<!--cd code/StableSigner3
CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_v1(无优化).py \ --pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \ --output_dir generated_sign_video \ --max_frame_num 240 \ --guidance_scale 3 \ --batch_frames 24 \ --sample_stride 2 \ --overlap 4 \ --height 768 \ --width 512 \ --controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \ --unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \ --validation_control_video_path ControlNeXt-SVD-v2/examples/video/02.mp4 \ --ref_image_path ref_img_dict/03.jpeg-->
<!-- official
cd ControlNeXt-SVD-v2
```pythonCUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext.py \ --pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \ --output_dir generated_sign_video \ --max_frame_num 240 \ --guidance_scale 3 \ --batch_frames 24 \ --sample_stride 2 \ --overlap 6 \ --height 1024 \ --width 576 \ --controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \ --unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \ --validation_control_video_path ControlNeXt-SVD-v2/examples/video/02.mp4 \ --ref_image_path ControlNeXt-SVD-v2/examples/ref_imgs/01.jpeg```-->1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859#!/bin/bash
# Example 1: Run with pre-extracted pose video (bypass DWPose)echo "Running with pre-extracted pose video..."CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \ --pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \ --output_dir generated_sign_video_direct \ --max_frame_num 240 \ --guidance_scale 3 \ --batch_frames 24 \ --sample_stride 2 \ --overlap 4 \ --height 768 \ --width 512 \ --controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \ --unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \ --pose_video_path path/to/your/pose_video.mp4 \ --ref_image_path ref_img_dict/03.jpeg \ --precision fp16 \ --enable_xformers \ --decode_chunk_size 2
# Example 2: Run with pose images directory (bypass DWPose)# CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \# --pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \# --output_dir generated_sign_video_direct \# --max_frame_num 240 \# --guidance_scale 3 \# --batch_frames 24 \# --sample_stride 1 \# --overlap 4 \# --height 768 \# --width 512 \# --controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \# --unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \# --pose_images_dir path/to/pose/images/directory \# --ref_image_path ref_img_dict/03.jpeg \# --precision fp16 \# --enable_xformers \# --decode_chunk_size 2
# Example 3: Original mode with DWPose extraction# CUDA_VISIBLE_DEVICES=0 python ControlNeXt-SVD-v2/run_controlnext_optimized.py \# --pretrained_model_name_or_path stabilityai/stable-video-diffusion-img2vid-xt-1-1 \# --output_dir generated_sign_video_optimized \# --max_frame_num 240 \# --guidance_scale 3 \# --batch_frames 24 \# --sample_stride 2 \# --overlap 4 \# --height 768 \# --width 512 \# --controlnext_path ControlNeXt-SVD-v2/pretrained/controlnet.bin \# --unet_path ControlNeXt-SVD-v2/pretrained/unet.bin \# --validation_control_video_path ControlNeXt-SVD-v2/examples/video/02.mp4 \# --ref_image_path ref_img_dict/03.jpeg \# --precision fp16 \# --enable_xformers \# --decode_chunk_size 2ControlNeXt-SVD-v2/git_push2.logDeleted-15
ControlNeXt-SVD-v2/run_controlnext_optimized.pyAdded+383
ControlNeXt-SVD-v2/utils/__pycache__/pre_process_direct.cpython-310.pycAdded
ControlNeXt-SVD-v2/utils/pre_process_direct.pyAdded+182
README.md+16-28
easy_dwpose/__pycache__/__init__.cpython-310.pycAdded
easy_dwpose/__pycache__/dwpose.cpython-310.pycAdded
easy_dwpose/body_estimation/__pycache__/__init__.cpython-310.pycAdded
easy_dwpose/body_estimation/__pycache__/detector.cpython-310.pycAdded
easy_dwpose/body_estimation/__pycache__/pose.cpython-310.pycAdded
easy_dwpose/body_estimation/__pycache__/utils.cpython-310.pycAdded
easy_dwpose/body_estimation/__pycache__/wholebody.cpython-310.pycAdded
easy_dwpose/draw/__pycache__/__init__.cpython-310.pycAdded
easy_dwpose/draw/__pycache__/controlnext.cpython-310.pycAdded
easy_dwpose/draw/__pycache__/openpose.cpython-310.pycAdded
generated_pose_video/GOOD_AFTERNOON_25073_01435_20250803_222800.mp4Added+3
generated_sign_video/output.mp4+2-2
generated_sign_video/test_1.mp4+2-2
generated_sign_video_direct/GOOD_AFTERNOON_25073_01435_20250803_222800.mp4Added+3
generated_sign_video_direct/GOOD_AFTERNOON_25073_01435_20250803_222800_combined.mp4Added+3
useless/abandon_cmd.mdAdded+64
ControlNeXt-SVD-v2/run_controlnext.py → useless/run_controlnext_v1(无优化.pyRenamed
useless/run_with_pose_video.shAdded+59