[CVPR 2026] PersonaLive! : Expressive Portrait Image Animation for Live Streaming
Fix some bugs
huai-chang77b606dd14b2
diff --git a/README.md b/README.mdindex c3d6efc..a7c74f9 100644--- a/README.md+++ b/README.md@@ -14,9 +14,11 @@<img src="assets/demo_3.gif" width="46%"> <img src="assets/demo_2.gif" width="40.5%"></div>-## π£ Updates-- **[2025.12.15]** π₯ Release `paper`!-- **[2025.12.12]** π₯ Release `inference code`, `config` and `pretrained weights`!+## π TODO+- [ ] Fix bugs (If you encounter any issues, please feel free to open an issue or contact me! π)+- [ ] Enhance WebUI (Support reference image replacement).+- [x] **[2025.12.15]** π₯ Release `paper`!+- [x] **[2025.12.12]** π₯ Release `inference code`, `config` and `pretrained weights`!## βοΈ Framework<img src="assets/overview.png" alt="Image 1" width="100%">@@ -84,6 +86,11 @@ pretrained_weights```python inference_offline.py```+β οΈ Note for RTX 50-Series (Blackwell) Users: xformers is not yet fully compatible with the new architecture. To avoid crashes, please disable it by running:+```+python inference_offline.py --use_xformers False+```+### πΈ Online Inference#### π¦ Setup Web UI```@@ -106,11 +113,33 @@ python torch2trt.py#### βΆοΈ Start Streaming```-python inference_online.py+python inference_online.py --acceleration none (for RTX 50-Series) or xformers or tensorrt```then open `http://0.0.0.0:7860` in your browser. (*If `http://0.0.0.0:7860` does not work well, try `http://localhost:7860`)-## π Citation+**How to use**: Upload Image β‘οΈ Fuse Reference β‘οΈ Start Animation β‘οΈ Enjoy! π++**Regarding Latency**: Latency varies depending on your device's computing power. You can try the following methods to optimize it:++1. Lower the "Driving FPS" setting in the WebUI to reduce the computational workload.+2. You can increase the multiplier (e.g., set to `num_frames_needed * 4` or higher) to better match your device's inference speed. https://github.com/GVCLab/PersonaLive/blob/6953d1a8b409f360a3ee1d7325093622b29f1e22/webcam/util.py#L73++<div align="center">+ <img src="assets/guide.png" alt="PersonaLive" width="70%">+</div>++++## π Community Guides++Special thanks to the community for providing helpful setups! π»++* **Windows + RTX 50-Series Guide**: Thanks to @dknos for providing a [detailed guide](https://github.com/GVCLab/PersonaLive/issues/10#issuecomment-3662785532) on running this project on Windows with Blackwell GPUs.++* **TensorRT on Windows**: If you are trying to convert TensorRT models on Windows, [this discussion](https://github.com/GVCLab/PersonaLive/issues/8) might be helpful. Special thanks to @MaraScott and @Jeremy8776 for their insights.+++## β CitationIf you find PersonaLive useful for your research, welcome to π this repo and cite our work using the following BibTeX:```bibtex@article{li2025personalive,diff --git a/assets/guide.png b/assets/guide.pngnew file mode 100644index 0000000..9f7f5bcBinary files /dev/null and b/assets/guide.png differdiff --git a/inference_offline.py b/inference_offline.pyindex 924ab18..9025926 100644--- a/inference_offline.py+++ b/inference_offline.py@@ -35,6 +35,7 @@ def parse_args():parser.add_argument("-L", type=int, default=100)parser.add_argument("--seed", type=int, default=42)parser.add_argument("--device", type=str, default="cuda")+ parser.add_argument("--use_xformers", type=bool, default=True)args = parser.parse_args()return args@@ -121,13 +122,15 @@ def main(args):strict=False,)- if is_xformers_available():- reference_unet.enable_xformers_memory_efficient_attention()- denoising_unet.enable_xformers_memory_efficient_attention()- else:- raise ValueError(- "xformers is not available. Make sure it is installed correctly"- )+ if args.use_xformers:+ if is_xformers_available():+ try:+ reference_unet.enable_xformers_memory_efficient_attention()+ denoising_unet.enable_xformers_memory_efficient_attention()+ except Exception as e:+ print("Failed to enable xformers:", e)+ else:+ print("xformers is not available. Make sure it is installed correctly.")mp_face_mesh = mp.solutions.face_meshface_mesh = mp_face_mesh.FaceMesh(static_image_mode=True, max_num_faces=1)diff --git a/inference_online.py b/inference_online.pyindex 924aa98..e1e1e8f 100644--- a/inference_online.py+++ b/inference_online.py@@ -24,12 +24,8 @@ from webcam.util import pil_to_frame, bytes_to_pil, is_firefox, bytes_to_tensorfrom webcam.connection_manager import ConnectionManager, ServerFullExceptionimport multiprocessing as mp-use_trt = False # set to True to use TensorRT acceleration--if use_trt:- from webcam.vid2vid_trt import Pipeline-else:- from webcam.vid2vid import Pipeline+from webcam.vid2vid_trt import Pipeline as Pipeline_trt+from webcam.vid2vid import Pipelinemimetypes.add_type("application/javascript", ".js")@@ -291,7 +287,10 @@ if __name__ == "__main__":mp.set_start_method("spawn", force=True)device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")- pipeline = Pipeline(config, device)+ if config.acceleration == "tensorrt":+ pipeline = Pipeline_trt(config, device)+ else:+ pipeline = Pipeline(config, device)app_obj = App(config, pipeline)app = app_obj.appdiff --git a/requirements_base.txt b/requirements_base.txtindex ebbea84..3f46705 100644--- a/requirements_base.txt+++ b/requirements_base.txt@@ -22,8 +22,7 @@ scikit-image==0.22.0starlette==0.48.0tqdm==4.67.1transformers==4.36.2-uvicorn==0.37.0+uvicorn[standard]xformers==0.0.22.post7peft==0.10.0-python-multipart==0.0.20-uvicorn==0.37.0\ No newline at end of file+python-multipart==0.0.20\ No newline at end of filediff --git a/src/wrapper.py b/src/wrapper.pyindex c6de821..a840585 100644--- a/src/wrapper.py+++ b/src/wrapper.py@@ -27,8 +27,8 @@ def map_device(device_or_str):return device_or_str if isinstance(device_or_str, torch.device) else torch.device(device_or_str)class PersonaLive:- def __init__(self, config_path, device=None):- cfg = OmegaConf.load(config_path)+ def __init__(self, args, device=None):+ cfg = OmegaConf.load(args.config_path)if(device is None):self.device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")else:@@ -145,7 +145,11 @@ class PersonaLive:self.cfg = cfgtorch.cuda.empty_cache()- self.enable_xformers_memory_efficient_attention()+ if args.acceleration == "xformers":+ try:+ self.enable_xformers_memory_efficient_attention()+ except Exception as e:+ print("Failed to enable xformers:", e)def enable_xformers_memory_efficient_attention(self):self.reference_unet.enable_xformers_memory_efficient_attention()diff --git a/src/wrapper_trt.py b/src/wrapper_trt.pyindex fa1b534..e650699 100644--- a/src/wrapper_trt.py+++ b/src/wrapper_trt.py@@ -28,8 +28,8 @@ def map_device(device_or_str):return device_or_str if isinstance(device_or_str, torch.device) else torch.device(device_or_str)class PersonaLive:- def __init__(self, config_path, device=None):- cfg = OmegaConf.load(config_path)+ def __init__(self, args, device=None):+ cfg = OmegaConf.load(args.config_path)if(device is None):self.device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")else:@@ -126,7 +126,11 @@ class PersonaLive:"u20", "u21", "u22", "u30", "u31", "u32"]torch.cuda.empty_cache()- self.enable_xformers_memory_efficient_attention()+ if args.acceleration == "xformers":+ try:+ self.enable_xformers_memory_efficient_attention()+ except Exception as e:+ print("Failed to enable xformers:", e)def enable_xformers_memory_efficient_attention(self):self.reference_unet.enable_xformers_memory_efficient_attention()diff --git a/webcam/frontend/src/routes/+page.svelte b/webcam/frontend/src/routes/+page.svelteindex 179dd03..27a9c52 100644--- a/webcam/frontend/src/routes/+page.svelte+++ b/webcam/frontend/src/routes/+page.svelte@@ -197,7 +197,7 @@</div><div class="sm:col-span-2 border border-slate-300 rounded-lg p-4 flex gap-4 justify-center"><div class="flex items-center gap-4 flex-1">- <span class="text-sm font-bold whitespace-nowrap">Target FPS: {fps}</span>+ <span class="text-sm font-bold whitespace-nowrap">Driving FPS: {fps}</span><inputtype="range"diff --git a/webcam/vid2vid.py b/webcam/vid2vid.pyindex 86e28dd..491b931 100644--- a/webcam/vid2vid.py+++ b/webcam/vid2vid.py@@ -63,7 +63,7 @@ class Pipeline:self.process = Process(target=generate_process,- args=(self.args.config_path, self.prepare_event, self.restart_event, self.stop_event, self.input_queue, self.output_queue, self.reference_queue, self.device),+ args=(self.args, self.prepare_event, self.restart_event, self.stop_event, self.input_queue, self.output_queue, self.reference_queue, self.device),daemon=True)self.process.start()@@ -109,7 +109,7 @@ class Pipeline:print("Pipeline closed successfully")def generate_process(- config_path,+ args,prepare_event,restart_event,stop_event,@@ -118,7 +118,7 @@ def generate_process(reference_queue,device):torch.set_grad_enabled(False)- pipeline = PersonaLive(config_path, device)+ pipeline = PersonaLive(args, device)chunk_size = 4prepare_event.set()diff --git a/webcam/vid2vid_trt.py b/webcam/vid2vid_trt.pyindex a834b74..9d0d666 100644--- a/webcam/vid2vid_trt.py+++ b/webcam/vid2vid_trt.py@@ -63,7 +63,7 @@ class Pipeline:self.process = Process(target=generate_process,- args=(self.args.config_path, self.prepare_event, self.restart_event, self.stop_event, self.input_queue, self.output_queue, self.reference_queue, self.device),+ args=(self.args, self.prepare_event, self.restart_event, self.stop_event, self.input_queue, self.output_queue, self.reference_queue, self.device),daemon=True)self.process.start()@@ -109,7 +109,7 @@ class Pipeline:print("Pipeline closed successfully")def generate_process(- config_path,+ args,prepare_event,restart_event,stop_event,@@ -118,7 +118,7 @@ def generate_process(reference_queue,device):torch.set_grad_enabled(False)- pipeline = PersonaLive(config_path, device)+ pipeline = PersonaLive(args, device)chunk_size = 4prepare_event.set()