Run this model with HF Jobs
Run PixArt-alpha/PixArt-LCM-XL-2-1024-MS on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/PixArt-alpha/PixArt-LCM-XL-2-1024-MS. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/PixArt-alpha/PixArt-LCM-XL-2-1024-MS on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use PixArt-alpha/PixArt-LCM-XL-2-1024-MS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use PixArt-alpha/PixArt-LCM-XL-2-1024-MS with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("PixArt-alpha/PixArt-LCM-XL-2-1024-MS", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Commit ·
4005a92
1
Parent(s): f395921
First add PixArt-LCM model card.
Browse filesFiles changed (4)
- .DS_StoreAdded
- README.md+127-1
- asset/model.pngAdded
- asset/pixart-lcm2.pngAdded
123---license: openrail++---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129---license: openrail++tags:- text-to-image- Pixart-α- LCM---<p align="center"><img src="asset/pixart-lcm2.png" height=120></p><div style="display:flex;justify-content: center"><a href="https://pixart-alpha.github.io/"><img src="https://img.shields.io/static/v1?label=Project%20Page&message=Github&color=blue&logo=github-pages"></a>  <a href="https://huggingface.co/spaces/PixArt-alpha/PixArt-alpha"><img src="https://img.shields.io/static/v1?label=Demo PixArt&message=HuggingFace&color=yellow"></a>  <a href="https://huggingface.co/spaces/PixArt-alpha/PixArt-LCM"><img src="https://img.shields.io/static/v1?label=Demo PixArt-LCM&message=HuggingFace&color=yellow"></a>  <a href="https://arxiv.org/abs/2310.00426"><img src="https://img.shields.io/static/v1?label=PixArt&message=Arxiv&color=red&logo=arxiv"></a>  <a href="https://arxiv.org/abs/2310.04378"><img src="https://img.shields.io/static/v1?label=LCM&message=Arxiv&color=red&logo=arxiv"></a>  <a href="https://github.com/orgs/PixArt-alpha/discussions"><img src="https://img.shields.io/static/v1?label=Discussion&message=Github&color=green&logo=github"></a>  </div># 🐱 Pixart-LCM Model Card## Model[Pixart-α](https://arxiv.org/abs/2310.00426) consists of pure transformer blocks for latent diffusion:It can directly generate 1024px images from text prompts within a single sampling process.[LCMs](https://arxiv.org/abs/2310.04378) is a diffusion distillation method which predict PF-ODE's solution directly in latent space, achieving super fast inference with few steps.Source code of PixArt-LCM is available at https://github.com/PixArt-alpha/PixArt-alpha.### Model Description- **Developed by:** Pixart & LCM teams- **Model type:** Diffusion-Transformer-based text-to-image generative model- **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENSE.md)- **Model Description:** This is a model that can be used to generate and modify images based on text prompts.It is a [Transformer Latent Diffusion Model](https://arxiv.org/abs/2310.00426) that uses one fixed, pretrained text encoders ([T5](https://huggingface.co/DeepFloyd/t5-v1_1-xxl))and one latent feature encoder ([VAE](https://arxiv.org/abs/2112.10752)).- **Resources for more information:** Check out our [PixArt-α](https://github.com/PixArt-alpha/PixArt-alpha), [LCM](https://github.com/luosiallen/latent-consistency-model) GitHub Repositoryand the [Pixart-α](https://arxiv.org/abs/2310.00426), [LCM](https://arxiv.org/abs/2310.04378) reports on arXiv.### Model SourcesFor research purposes, we recommend our `generative-models` Github repository (https://github.com/PixArt-alpha/PixArt-alpha),which is more suitable for developing both training and inference designs.[Hugging Face](https://huggingface.co/spaces/PixArt-alpha/PixArt-LCM) provides free Pixart-LCM inference.- **Repository:** https://github.com/PixArt-alpha/PixArt-alpha- **Demo:** https://huggingface.co/spaces/PixArt-alpha/PixArt-LCM### 🧨 DiffusersMake sure to upgrade diffusers to >= 0.23.0:```pip install -U diffusers --upgrade```In addition make sure to install `transformers`, `safetensors`, `sentencepiece`, and `accelerate`:```pip install transformers accelerate safetensors sentencepiece```To just use the base model, you can run:```pythonimport torchfrom diffusers import PixArtAlphaPipeline# only 1024-MS version is supported for nowpipe = PixArtAlphaPipeline.from_pretrained("PixArt-alpha/PixArt-LCM-XL-2-1024-MS", torch_dtype=torch.float16, use_safetensors=True)# Enable memory optimizations.pipe.enable_model_cpu_offload()prompt = "A small cactus with a happy face in the Sahara desert."image = pipe(prompt).images[0]```When using `torch >= 2.0`, you can improve the inference speed by 20-30% with torch.compile. Simple wrap the unet with torch compile before running the pipeline:```pypipe.transformer = torch.compile(pipe.transformer, mode="reduce-overhead", fullgraph=True)```If you are limited by GPU VRAM, you can enable *cpu offloading* by calling `pipe.enable_model_cpu_offload`instead of `.to("cuda")`:```diff- pipe.to("cuda")+ pipe.enable_model_cpu_offload()```The diffusers use here is totally the same as the base-model PixArt-α.For more information on how to use Pixart-α with `diffusers`, please have a look at [the Pixart-α Docs](https://huggingface.co/docs/diffusers/main/en/api/pipelines/pixart).## Uses### Direct UseThe model is intended for research purposes only. Possible research areas and tasks include- Generation of artworks and use in design and other artistic processes.- Applications in educational or creative tools.- Research on generative models.- Safe deployment of models which have the potential to generate harmful content.- Probing and understanding the limitations and biases of generative models.Excluded uses are described below.### Out-of-Scope UseThe model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.## Limitations and Bias### Limitations- The model does not achieve perfect photorealism- The model cannot render legible text- The model struggles with more difficult tasks which involve compositionality, such as rendering an image corresponding to “A red cube on top of a blue sphere”- fingers, .etc in general may not be generated properly.- The autoencoding part of the model is lossy.### BiasWhile the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
.DS_StoreAdded
README.md+127-1
asset/model.pngAdded

asset/pixart-lcm2.pngAdded
