diff --git a/nodes/rife_tensorrt.py b/nodes/rife_tensorrt.py index 81f2397..f85d529 100644 --- a/nodes/rife_tensorrt.py +++ b/nodes/rife_tensorrt.py @@ -46,7 +46,7 @@ class RifeTensorrt: def return_middle_frame(frame_0, frame_1, timestep): timestep_t = torch.tensor([timestep], dtype=torch.float32).to(get_torch_device()) - output = engine.infer({"img0": frame_0, "img1": frame_1, "timestep": timestep_t}, cudaStream, use_cuda_graph) + output = engine.infer({"img0": frame_0, "img1": frame_1, "timestep": timestep_t}, cudaStream) result = output['output'] return result diff --git a/readme.md b/readme.md index d165869..6c419db 100644 --- a/readme.md +++ b/readme.md @@ -2,9 +2,9 @@ # ComfyUI Rife TensorRT ⚡ -[![python](https://img.shields.io/badge/python-3.12.11-green)](https://www.python.org/downloads/release/python-31211/) -[![cuda](https://img.shields.io/badge/cuda-12.9-green)](https://developer.nvidia.com/cuda-downloads) -[![trt](https://img.shields.io/badge/TRT-10.13.3.9-green)](https://developer.nvidia.com/tensorrt) +[![python](https://img.shields.io/badge/python-3.12.3-green)](https://www.python.org/downloads/release/python-3123//) +[![cuda](https://img.shields.io/badge/cuda-13.0-green)](https://developer.nvidia.com/cuda-downloads) +[![trt](https://img.shields.io/badge/TRT-10.14.1.48-green)](https://developer.nvidia.com/tensorrt) [![by-nc-sa/4.0](https://img.shields.io/badge/license-CC--BY--NC--SA--4.0-lightgrey)](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en) ![node](https://github.com/user-attachments/assets/5fd6d529-300c-42a5-b9cf-46e031f0bcb5) @@ -12,11 +12,22 @@ -This project provides a [TensorRT](https://github.com/NVIDIA/TensorRT) implementation of [RIFE](https://github.com/hzwer/ECCV2022-RIFE) for ultra fast frame interpolation inside ComfyUI +## ⭐ Support +If you like my projects and wish to see updates and new features, please consider supporting me. It helps a lot! -This project is licensed under [CC BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/4.0/), everyone is FREE to access, use, modify and redistribute with the same license. +[![ComfyUI-Depth-Anything-Tensorrt](https://img.shields.io/badge/ComfyUI--Depth--Anything--Tensorrt-blue?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-Depth-Anything-Tensorrt) +[![ComfyUI-Upscaler-Tensorrt](https://img.shields.io/badge/ComfyUI--Upscaler--Tensorrt-blue?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-Upscaler-Tensorrt) +[![ComfyUI-Dwpose-Tensorrt](https://img.shields.io/badge/ComfyUI--Dwpose--Tensorrt-blue?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-Dwpose-Tensorrt) +[![ComfyUI-Rife-Tensorrt](https://img.shields.io/badge/ComfyUI--Rife--Tensorrt-blue?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-Rife-Tensorrt) -If you like the project, please give me a star! ⭐ +[![ComfyUI-Whisper](https://img.shields.io/badge/ComfyUI--Whisper-gray?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-Whisper) +[![ComfyUI_InvSR](https://img.shields.io/badge/ComfyUI__InvSR-gray?style=flat-square)](https://github.com/yuvraj108c/ComfyUI_InvSR) +[![ComfyUI-Thera](https://img.shields.io/badge/ComfyUI--Thera-gray?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-Thera) +[![ComfyUI-Video-Depth-Anything](https://img.shields.io/badge/ComfyUI--Video--Depth--Anything-gray?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-Video-Depth-Anything) +[![ComfyUI-PiperTTS](https://img.shields.io/badge/ComfyUI--PiperTTS-gray?style=flat-square)](https://github.com/yuvraj108c/ComfyUI-PiperTTS) + +[![buy-me-coffees](https://i.imgur.com/3MDbAtw.png)](https://www.buymeacoffee.com/yuvraj108cZ) +[![paypal-donation](https://i.imgur.com/w5jjubk.png)](https://paypal.me/yuvraj108c) --- @@ -59,7 +70,7 @@ Models are automatically downloaded from [HuggingFace](https://huggingface.co/yu 2. **Process Frames**: Insert `Right Click -> Add Node -> tensorrt -> Rife Tensorrt` - Connect the loaded model from step 1 - Input your video frames - - Configure interpolation settings (multiplier, CUDA graph, etc.) + - Configure interpolation settings (multiplier, etc.) - Image resolutions between `256x256` and `3840x3840` are supported ## 🤖 Environment tested @@ -69,10 +80,10 @@ Models are automatically downloaded from [HuggingFace](https://huggingface.co/yu ## 🚨 Updates -### December 2025 -- **Automatic Model Management**: No more manual downloads! Models are automatically downloaded from HuggingFace and TensorRT engines are built on demand -- **Improved Workflow**: New two-node system with `Load Rife Tensorrt Model` + `Rife Tensorrt` for better organization -- **Updated Dependencies**: TensorRT updated to 10.13.3.9 for better performance and compatibility +### 08 June 2026 +- **Automatic Model Management**: No more manual downloads! Models are automatically downloaded from HuggingFace and TensorRT engines are built on demand. [PR#14](https://github.com/yuvraj108c/ComfyUI-Rife-Tensorrt/pull/14) by [@reaperhammer](https://github.com/reaperhammer) +- **Improved Workflow + Codebase**: New two-node system with `Load Rife Tensorrt Model` + `Rife Tensorrt` for better organization +- **Remove cuda-python**: No more cuda installation issues on windows ## 👏 Credits diff --git a/vfi_utilities.py b/vfi_utilities.py index 4cd3d33..88d7b16 100644 --- a/vfi_utilities.py +++ b/vfi_utilities.py @@ -7,7 +7,9 @@ import einops from comfy.model_management import soft_empty_cache, get_torch_device import numpy as np from comfy.utils import ProgressBar -from colored import Fore, Back, Style +from colored import Fore, Back, Style +from .utilities import rife_logger +from tqdm import tqdm DEVICE = get_torch_device() @@ -25,9 +27,6 @@ def load_file_from_github_release(model_type, ckpt_name): error_str = '\n\n'.join(error_strs) raise Exception(f"Tried all GitHub base urls to download {ckpt_name} but no suceess. Below is the error log:\n\n{error_str}") -def logger(msg): - print(f'{Style.reset}{Fore.cyan}⚡ [Rife Tensorrt] - {msg}{Style.reset}') - def preprocess_frames(frames): return einops.rearrange(frames[..., :3], "n h w c -> n c h w") @@ -45,7 +44,15 @@ def generate_frames_rife( out_len = 0 number_of_frames_processed_since_last_cleared_cuda_cache = 0 - pbar = ProgressBar(len(frames)) + pbar = ProgressBar(len(frames)-1) + + bar_format = "[\033[94mComfyUI-Rife-Tensorrt\033[0m|\033[92mINFO\033[0m] - \033[92m{desc}: {percentage:3.0f}%|{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}]" + progress_bar = tqdm( + total=len(frames)-1, + desc="Interpolating", + bar_format=bar_format, + disable=((len(frames)-1) == 1) + ) for frame_itr in range(len(frames) - 1): # Skip the final frame since there are no frames after it @@ -67,22 +74,25 @@ def generate_frames_rife( if number_of_frames_processed_since_last_cleared_cuda_cache >= clear_cache_after_n_frames: soft_empty_cache() number_of_frames_processed_since_last_cleared_cuda_cache = 0 - logger("Clearing cache...") + rife_logger.info("Clearing cache...") pbar.update(1) + progress_bar.update(1) - + progress_bar.refresh() + progress_bar.close() + # Append final frame output_frames[out_len] = frames[-1:] # Get actual frame shape from first interpolated frame (CHW format) actual_frame = output_frames[0] h, w = actual_frame.shape[1], actual_frame.shape[2] - logger(f"done! - {out_len} total frames output at resolution: {h}x{w}") + rife_logger.info(f"done! - {out_len} total frames output at resolution: {h}x{w}") out_len += 1 # clear cache for courtesy soft_empty_cache() - logger("Final clearing cache done ...") + rife_logger.info("Final clearing cache done ...") # res = output_frames[:out_len] return res \ No newline at end of file