Home

Awesome

<h1 align="center">🪄SCEPTER</h1> <p align="center"> <img src="https://img.shields.io/badge/python-%E2%89%A53.8-5be.svg"> <img src="https://img.shields.io/badge/pytorch-%E2%89%A51.12%20%7C%20%E2%89%A52.0-orange.svg"> <a href="https://pypi.org/project/scepter/"><img src="https://badge.fury.io/py/scepter.svg"></a> <a href="https://github.com/modelscope/scepter/blob/main/LICENSE"><img src="https://img.shields.io/github/license/modelscope/scepter"></a> <a href="https://github.com/modelscope/scepter/"><img src="https://img.shields.io/badge/scepter-Build from source-6FEBB9.svg"></a> </p>

🪄SCEPTER is an open-source code repository dedicated to generative training, fine-tuning, and inference, encompassing a suite of downstream tasks such as image generation, transfer, editing. SCEPTER integrates popular community-driven implementations as well as proprietary methods by Tongyi Lab of Alibaba Group, offering a comprehensive toolkit for researchers and practitioners in the field of AIGC. This versatile library is designed to facilitate innovation and accelerate development in the rapidly evolving domain of generative models.

SCEPTER offers 3 core components:

🎉 News

🖼 Gallery for Recent Works

Edit Tuners

Simply provide 10 image pairs, SCEPTER will tune an edit tuner for your own Image-to-Image tasks, like Clay Style, De-Text, Segmentation, etc. Try our official few-shot datasets: De-Text, Image2Hed, Image2Depth, Depth2Image.

<table><tbody> <tr> <th align="center" colspan="4">Clay Style<br>Prompt: "Convert this image into clay style"</th> </tr> <tr> <td><img src="asset/images/edit_tuner/vermeer.jpeg" width="300"></td> <td><img src="asset/images/edit_tuner/clay_vermeer.jpeg" width="300"></td> <td><img src="asset/images/edit_tuner/cat_512.jpg" width="300"></td> <td><img src="asset/images/edit_tuner/clay_cat.jpeg" width="300"></td> </tr> <tr> <th align="center" colspan="2">De-Text<br>Prompt: "Remove the texts"</th> <th align="center" colspan="2">Image2Hed<br>Prompt: "Convert to an edge map"</th> </tr> <tr> <td><img src="asset/images/edit_tuner/text.jpg" width="300"></td> <td><img src="asset/images/edit_tuner/detext.jpeg" width="300"></td> <td><img src="asset/images/edit_tuner/cat_512.jpg" width="300"></td> <td><img src="asset/images/edit_tuner/hed.jpeg" width="300"></td> </tr> <tr> <th align="center" colspan="2">Image2Depth<br>Prompt: "Calculate the depth map"</th> <th align="center" colspan="2">Depth2Image<br>Prompt: "Convert depth map into color image"</th> </tr> <tr> <td><img src="asset/images/edit_tuner/house.jpg" width="300"></td> <td><img src="asset/images/edit_tuner/image2depth.jpeg" width="300"></td> <td><img src="asset/images/edit_tuner/depth.jpg" width="300"></td> <td><img src="asset/images/edit_tuner/depth2image.jpeg" width="300"></td> </tr> </tbody> </table> Note: Left image is input and right image is output.

🛠️ Installation

conda env create -f environment.yaml
conda activate scepter

We recommend installing the specific version of PyTorch and accelerate toolbox xFormers. You can install these recommended version by pip:

pip install -r requirements/recommended.txt
pip install scepter

🧩 Generative Framework

Tutorials

DocumentationKey Features
TrainDDP / FSDP / FairScale / Xformers
InferenceDynamic load/unload
Dataset ManagementLocal / Http / OSS / Modelscope

📝 Popular Approaches

Currently supported approaches

TasksMethodsLinks
Text-to-image generationSD v1.5Hugging Face Repo
Text-to-image generationSD v2.1Hugging Face Repo
Text-to-image generationSD-XLHugging Face Repo
Efficient TuningLoRAArxiv   link
Efficient TuningRes-Tuning(NeurIPS23)Arxiv   link Page link
Controllable image synthesis🌟SCEdit(CVPR24)Arxiv   link Page link
Image editing🌟LAR-GenArxiv   link Page link
Image editing🌟StyleBoothArxiv   link Page link

🖥️ SCEPTER Studio

Launch

To fully experience SCEPTER Studio, you can launch the following command line:

pip install scepter
python -m scepter.tools.webui

or run after clone repo code

git clone https://github.com/modelscope/scepter.git
PYTHONPATH=. python scepter/tools/webui.py --cfg scepter/methods/studio/scepter_ui.yaml

The startup of SCEPTER Studio eliminates the need for manual downloading and organizing of models; it will automatically load the corresponding models and store them in a local directory. Depending on the network and hardware situation, the initial startup usually requires 15-60 minutes, primarily involving the download and processing of SDv1.5, SDv2.1, and SDXL models. Therefore, subsequent startups will become much faster (about one minute) as downloading is no longer required.

Usage Demo

Image EditingTrainingModel SharingModel InferenceData Management
<video src="https://www.modelscope.cn/api/v1/models/iic/scepter/repo?Revision=master&FilePath=assets%2Fscepter_studio%2Fimage_editing_20240419.webm" width="240" controls></video><video src="https://www.modelscope.cn/api/v1/models/iic/scepter/repo?Revision=master&FilePath=assets%2Fscepter_studio%2Ftraining_20240419.webm" width="240" controls></video><video src="https://www.modelscope.cn/api/v1/models/iic/scepter/repo?Revision=master&FilePath=assets%2Fscepter_studio%2Fmodel_sharing_20240419.webm" width="240" controls></video><video src="https://www.modelscope.cn/api/v1/models/iic/scepter/repo?Revision=master&FilePath=assets%2Fscepter_studio%2Fmodel_inference_20240419.webm" width="240" controls></video><video src="https://www.modelscope.cn/api/v1/models/iic/scepter/repo?Revision=master&FilePath=assets%2Fscepter_studio%2Fdata_management_20240419.webm" width="240" controls></video>

Modelscope Studio & Huggingface Space

We deploy a work studio on Modelscope that includes only the inference tab, please refer to ms_scepter_studio and hf_scepter_studio

🔍 Learn More

BibTeX

If our work is useful for your research, please consider citing:

@misc{scepter,
    title = {SCEPTER, https://github.com/modelscope/scepter},
    author = {SCEPTER},
    year = {2023}
}

License

This project is licensed under the Apache License (Version 2.0).

Acknowledgement

Thanks to Stability-AI, SWIFT library and Fooocus for their awesome work.