SkillAgentSearch skills...

Facechain

FaceChain is a deep-learning toolchain for generating your Digital-Twin.

Install / Use

/learn @modelscope/Facechain
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<p align="center"> <br> <img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" width="400"/> <br> <h1>FaceChain</h1> <p> <p align="center"> <a href="https://trendshift.io/repositories/1185" target="_blank"><img src="https://trendshift.io/api/badge/repositories/1185" alt="modelscope%2Ffacechain | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> </p>

News

  • Our work FaceChain-MMID got accepted to Pattern Recognition ! (May 30th, 2025 UTC)
  • More Technology Details of FaceChain-FACT train-free portrait generation can be seen in Paper. (October 17th, 2024 UTC)
  • Our work TopoFR got accepted to NeurIPS 2024 ! (September 26th, 2024 UTC)
  • We provide training scripts for new styles, offering an automatic training for new style LoRas as well as the corresponding style prompts, along with the one click call in Infinite Style Portrait generation tab! (July 3rd, 2024 UTC)
  • 🚀🚀🚀 We are launching [FACT] into the main branch, offering a 10-second impressive speed and seamless integration with standard ready-to-use LoRas and ControlNets, along with improved instruction-following capabilities ! The original train-based FaceChain is moved to (https://github.com/modelscope/facechain/tree/v3.0.0 ). (May 28th, 2024 UTC)
  • Our work FaceChain-ImagineID and FaceChain-SuDe got accepted to CVPR 2024 ! (February 27th, 2024 UTC)

Introduction

如果您熟悉中文,可以阅读中文版本的README

FaceChain is a novel framework for generating identity-preserved human portraits. In the newest FaceChain FACT (Face Adapter with deCoupled Training) version, with only 1 photo and 10 seconds, you can generate personal portraits in different settings (multiple styles now supported!). FaceChain has both high controllability and authenticity in portrait generation, including text-to-image and inpainting based pipelines, and is seamlessly compatible with ControlNet and LoRAs. You may generate portraits via FaceChain's Python scripts, or via the familiar Gradio interface, or via sd webui. FaceChain is powered by ModelScope.

<p align="center"> ModelScope Studio <a href="https://modelscope.cn/studios/CVstudio/FaceChain-FACT">🤖<a></a>&nbsp |API <a href="https://help.aliyun.com/zh/dashscope/developer-reference/facechain-quick-start">🔥<a></a>&nbsp | SD WebUI | HuggingFace Space <a href="https://huggingface.co/spaces/modelscope/FaceChain-FACT">🤗</a>&nbsp </p> <br>

<a href='https://facechain-fact.github.io/'><img src='https://img.shields.io/badge/Project-Page-Green'></a> YouTube

image

News

  • Our work FaceChain-MMID got accepted to Pattern Recognition ! (May 30th, 2025 UTC)
  • More Technology Details of FaceChain-FACT train-free portrait generation can be seen in Paper. (October 17th, 2024 UTC)
  • Our work TopoFR got accepted to NeurIPS 2024 ! (September 26th, 2024 UTC)
  • We provide training scripts for new styles, offering an automatic training for new style LoRas as well as the corresponding style prompts, along with the one click call in Infinite Style Portrait generation tab! (July 3rd, 2024 UTC)
  • 🚀🚀🚀 We are launching [FACT], offering a 10-second impressive speed and seamless integration with standard ready-to-use LoRas and ControlNets, along with improved instruction-following capabilities ! (May 28th, 2024 UTC)
  • Our work FaceChain-ImagineID and FaceChain-SuDe got accepted to CVPR 2024 ! (February 27th, 2024 UTC)
  • 🏆🏆🏆Alibaba Annual Outstanding Open Source Project, Alibaba Annual Open Source Pioneer (Yang Liu, Baigui Sun). (January 20th, 2024 UTC)
  • Our work InfoBatch co-authored with NUS team got accepted to ICLR 2024(Oral)! (January 16th, 2024 UTC)
  • 🏆OpenAtom's 2023 Rapidly Growing Open Source Projects Award. (December 20th, 2023 UTC)
  • Add SDXL pipeline🔥🔥🔥, image detail is improved obviously. (November 22th, 2023 UTC)
  • Support super resolution🔥🔥🔥, provide multiple resolution choice (512512, 768768, 10241024, 20482048). (November 13th, 2023 UTC)
  • 🏆FaceChain has been selected in the BenchCouncil Open100 (2022-2023) annual ranking. (November 8th, 2023 UTC)
  • Add virtual try-on module. (October 27th, 2023 UTC)
  • Add wanx version online free app. (October 26th, 2023 UTC)
  • 🏆1024 Programmer's Day AIGC Application Tool Most Valuable Business Award. (2023-10-24, 2023 UTC)
  • Support FaceChain in stable-diffusion-webui🔥🔥🔥. (October 13th, 2023 UTC)
  • High performance inpainting for single & double person, Simplify User Interface. (September 09th, 2023 UTC)
  • More Technology Details can be seen in Paper. (August 30th, 2023 UTC)
  • Add validate & ensemble for Lora training, and InpaintTab(hide in gradio for now). (August 28th, 2023 UTC)
  • Add pose control module. (August 27th, 2023 UTC)
  • Add robust face lora training module, enhance the performance of one pic training & style-lora blending. (August 27th, 2023 UTC)
  • HuggingFace Space is available now! You can experience FaceChain directly with <a href="https://huggingface.co/spaces/modelscope/FaceChain">🤗</a> (August 25th, 2023 UTC)
  • Add awesome prompts! Refer to: awesome-prompts-facechain (August 18th, 2023 UTC)
  • Support a series of new style models in a plug-and-play fashion. (August 16th, 2023 UTC)
  • Support customizable prompts. (August 16th, 2023 UTC)
  • Colab notebook is available now! You can experience FaceChain directly with Open In Colab. (August 15th, 2023 UTC)

To-Do List

  • full-body digital humans

Citation

Please cite FaceChain and FaceChain-FACT in your publications if it helps your research

@article{liu2023facechain,
  title={FaceChain: A Playground for Identity-Preserving Portrait Generation},
  author={Liu, Yang and Yu, Cheng and Shang, Lei and Wu, Ziheng and 
          Wang, Xingjun and Zhao, Yuze and Zhu, Lin and Cheng, Chen and 
          Chen, Weitao and Xu, Chao and Xie, Haoyu and Yao, Yuan and 
          Zhou,  Wenmeng and Chen Yingda and Xie, Xuansong and Sun, Baigui},
  journal={arXiv preprint arXiv:2308.14256},
  year={2023}
}
@article{yu2024facechain,
  title={FaceChain-FACT: Face Adapter with Decoupled Training for Identity-preserved Personalization},
  author={Yu, Cheng and Xie, Haoyu and Shang, Lei and Liu, Yang and Dan, Jun and Sun, Baigui and Bo, Liefeng},
  journal={arXiv preprint arXiv:2410.12312},
  year={2024}
}

Installation

Compatibility Verification

We have verified e2e execution on the following environment:

  • python: py3.8, py3.10
  • pytorch: torch2.0.0, torch2.0.1
  • CUDA: 11.7
  • CUDNN: 8+
  • OS: Ubuntu 20.04, CentOS 7.9
  • GPU: Nvidia-A10 24G

Memory Optimization

Jemalloc are recommanded to install for optimizing the memory from above 30G to below 20G. Here is an example for installing Jemalloc in Modelscope notebook.

apt-get install -y libjemalloc-dev
export LD_PRELOAD=/lib/x86_64-linux-gnu/libjemalloc.so

Installation Guide

The following installation methods are supported:

1. ModelScope notebook【recommended】

The ModelScope Notebook offers a free-tier that allows ModelScope user to run the FaceChain application with minimum setup, refer to ModelScope Notebook

# Step1: 我的notebook -> PAI-DSW -> GPU环境
# Note: Please use: ubuntu20.04-py38-torch2.0.1-tf1.15.5-modelscope1.8.1

# Step2: Entry the Notebook cell,clone FaceChain from github:
!GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/modelscope/facechain.git --depth 1

# Step3: Change the working directory to facechain, and install the dependencies:
import os
os.chdir('/mnt/workspace/facechain')    # You may change to your own path
print(os.getcwd())

!pip3 install gradio==3.47.1
!pip3 install controlnet_aux==0.0.6
!pip3 install python-slugify
!pip3 install diffusers==0.29.0
!pip3 install peft==0.11.1
!pip3 install modelscope -U
!pip3 install datasets==2.16

# Step4: Start the app service, click "public URL" or "local URL", upload your images to 
# train your own model and then generate your digital twin.
!python3 app.py

Alternatively, you may also purchase a PAI-DSW instance (using A10 resource), with the option of ModelScope image to run FaceChain following similar steps.

2. Docker

If you are familiar with using docker, we recommend to use this way:

# Step1: Prepare the environment with GPU on local or cloud, we recommend to use Alibaba Cloud ECS, refer to: https://www.aliyun.com/product/ecs

# Step2: Download the docker image (for installing docker engine, refer to https://docs.docker.com/engine/install/)
# For China Mainland users:
docker pull registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-cuda11.7.1-py38-torch2.0.1-tf1.15.5-1.8.1
# For users outside China Mainland:
docker pull registry.us-west-1.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-cuda11.7.1-py38-torch2.0.1-tf1.15.5-1.8.1

# Step3: run the docker container
docker run -it --name facechain -p 7860:7860 --gpus
View on GitHub
GitHub Stars9.5k
CategoryEducation
Updated1d ago
Forks889

Languages

Jupyter Notebook

Security Score

95/100

Audited on Apr 4, 2026

No findings