Model reference · open weights
LivePortra is an open-weight video model from KlingTeam. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Maker | KlingTeam |
|---|---|
| Type | Video models |
| Task | Image→video |
| Runs with | liveportrait |
| Released | 2024-07-08 |
| Popularity | 8k downloads / month |
| Licence | Open weights |
About
🔥 For more results, visit our homepage 🔥
2024/08/02: 😸 We released a version of the Animals model, along with several other updates and improvements. Check out the details here!2024/07/25: 📦 Windows users can now download the package from HuggingFace or BaiduYun. Simply unzip and double-click run_windows.bat to enjoy!2024/07/24: 🎨 We support pose editing for source portraits in the Gradio interface. We’ve also lowered the default detection threshold to increase recall. Have fun!2024/07/19: ✨ We support 🎞️ portrait video editing (aka v2v)! More to see here.2024/07/17: 🍎 We support macOS with Apple Silicon, modified from jeethu's PR #143.2024/07/10: 💪 We support audio and video concatenating, driving video auto-cropping, and template making to protect privacy. More to see here.2024/07/09: 🤗 We released the HuggingFace Space, thanks to the HF team and Gradio!2024/07/04: 😊 We released the initial version of the inference code and models. Continuous updates, stay tuned!2024/07/04: 🔥 We released the homepage and technical report on arXiv.This repo, named LivePortrait, contains the official PyTorch implementation of our paper LivePortrait: Efficient Portrait Animation with Stitching and Retargeting Control. We are actively updating and improving this repository. If you find any bugs or have suggestions, welcome to raise issues or submit pull requests (PR) 💖.
git clone https://github.com/KwaiVGI/LivePortrait
cd LivePortrait
# create env using conda
conda create -n LivePortrait python==3.9
conda activate LivePortrait
# install dependencies with pip
# for Linux and Windows users
pip install -r requirements.txt
# for macOS with Apple Silicon users
pip install -r requirements_macOS.txt
Note: make sure your system has FFmpeg installed, including both ffmpeg and ffprobe!
The easiest way to download the pretrained weights is from HuggingFace:
# first, ensure git-lfs is installed, see: https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage
git lfs install
# clone and move the weights
git clone https://huggingface.co/KwaiVGI/LivePortrait temp_pretrained_weights
mv temp_pretrained_weights/* pretrained_weights/
rm -rf temp_pretrained_weights
Alternatively, you can download all pretrained weights from Google Drive or Baidu Yun. Unzip and place them in ./pretrained_weights.
Ensuring the directory structure is as follows, or contains:
pretrained_weights
├── insightface
│ └── models
│ └── buffalo_l
│ ├── 2d106det.onnx
│ └── det_10g.onnx
└── liveportrait
├── base_models
│ ├── appearance_feature_extractor.pth
│ ├── motion_extractor.pth
│ ├── spade_generator.pth
│ └── warping_module.pth
├── landmark.onnx
└── retargeting_models
└── stitching_retargeting_module.pth
# For Linux and Windows
python inference.py
# For macOS with Apple Silicon, Intel not supported, this maybe 20x slower than RTX 4090
PYTORCH_ENABLE_MPS_FALLBACK=1 python inference.py
If the script runs successfully, you will get an output mp4 file named animations/s6--d0_concat.mp4. This file includes the following results: driving video, input image or video, and generated result.
Or, you can change the input by specifying the -s and -d arguments:
# source input is an image
python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d0.mp4
# source input is a video ✨
python inference.py -s assets/examples/source/s13.mp4 -d assets/examples/driving/d0.mp4
# more options to see
python inference.py -h
To use your own driving video, we recommend: ⬇️
--flag_crop_driving_video.Below is a auto-cropping case by --flag_crop_driving_video:
python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d13.mp4 --flag_crop_driving_video
If you find the results of auto-cropping is not well, you can modify the --scale_crop_driving_video, --vy_ratio_crop_driving_video options to adjust the scale and offset, or do it manually.
You can also use the auto-generated motion template files ending with .pkl to speed up inference, and protect privacy, such as:
python inference.py -s assets/examples/source/s9.jpg -d assets/examples/driving/d5.pkl # portrait animation
python inference.py -s assets/examples/source/s13.mp4 -d assets/examples/driving/d5.pkl # po
From the published model card. Full card on the HuggingFace links in the sidebar.
How it works
Using it via the API
Once AxForge deploys liveportra for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (liveportra below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/videos/generations \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"liveportra","prompt":"a drone shot over a forest"}'
Create an account — your API key is available in the console. 5M tokens/month currently included with every new account at launch.