Model reference · open weights
PixArt-Sigma-XL-2-512-MS is an open-weight image model from PixArt-alpha. 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 | PixArt-alpha |
|---|---|
| Type | Image models |
| Task | Text→image |
| Parameters (lead) | 611M |
| Runs with | diffusers |
| Released | 2024-04-11 |
| Popularity | 0 downloads / month |
| Licence | Open weights |
About
PixArt-Σ consists of pure transformer blocks for latent diffusion: It can directly generate 1024px, 2K and 4K images from text prompts within a single sampling process.
Source code is available at https://github.com/PixArt-alpha/PixArt-sigma.
For research purposes, we recommend our generative-models Github repository (https://github.com/PixArt-alpha/PixArt-sigma),
which is more suitable for both training and inference and for which most advanced diffusion sampler like SA-Solver will be added over time.
Hugging Face provides free PixArt-Σ inference.
[!IMPORTANT] Make sure to upgrade diffusers to >= 0.28.0:
pip install -U diffusers --upgradeIn addition make sure to install
transformers,safetensors,sentencepiece, andaccelerate:pip install transformers accelerate safetensors sentencepieceFor
diffusers<0.28.0, check this script for help.
To just use the base model, you can run:
import torch
from diffusers import Transformer2DModel, PixArtSigmaPipeline
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
weight_dtype = torch.float16
pipe = PixArtSigmaPipeline.from_pretrained(
"PixArt-alpha/PixArt-Sigma-XL-2-1024-MS",
torch_dtype=weight_dtype,
use_safetensors=True,
)
pipe.to(device)
# 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]
image.save("./catcus.png")
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:
pipe.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"):
- pipe.to("cuda")
+ pipe.enable_model_cpu_offload()
For more information on how to use PixArt-Σ with diffusers, please have a look at the PixArt-Σ Docs.
The 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.
The 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.
While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys pixart-sigma-xl-2-512-ms for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (pixart-sigma-xl-2-512-ms below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/images/generations \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"pixart-sigma-xl-2-512-ms","prompt":"a red bicycle","size":"1024x1024"}'
Create an account — your API key is available in the console. 5M tokens/month currently included with every new account at launch.