PixArt XL 2
pixart-xl-2
PixArt-Alpha 1024px is a transformer-based text-to-image diffusion system trained on text embeddings from T5
Model Information
Input
Configure model parameters
Output
View generated results
Result
Preview, share or download your results with a single click.

Prerequisites
- Create an API Key from the Eachlabs Console
- Install the required dependencies for your chosen language (e.g., requests for Python)
API Integration Steps
1. Create a Prediction
Send a POST request to create a new prediction. This will return a prediction ID that you'll use to check the result. The request should include your model inputs and API key.
import requestsimport timeAPI_KEY = "YOUR_API_KEY" # Replace with your API keyHEADERS = {"X-API-Key": API_KEY,"Content-Type": "application/json"}def create_prediction():response = requests.post("https://api.eachlabs.ai/v1/prediction/",headers=HEADERS,json={"model": "pixart-xl-2","version": "0.0.1","input": {"seed": null,"style": "None","width": "1024","height": "1024","prompt": "A small cactus with a happy face in the Sahara desert","scheduler": "DPMSolverMultistep","num_outputs": "1","guidance_scale": "4.5","negative_prompt": "your negative prompt here","num_inference_steps": "14"}})prediction = response.json()if prediction["status"] != "success":raise Exception(f"Prediction failed: {prediction}")return prediction["predictionID"]
2. Get Prediction Result
Poll the prediction endpoint with the prediction ID until the result is ready. The API uses long-polling, so you'll need to repeatedly check until you receive a success status.
def get_prediction(prediction_id):while True:result = requests.get(f"https://api.eachlabs.ai/v1/prediction/{prediction_id}",headers=HEADERS).json()if result["status"] == "success":return resultelif result["status"] == "error":raise Exception(f"Prediction failed: {result}")time.sleep(1) # Wait before polling again
3. Complete Example
Here's a complete example that puts it all together, including error handling and result processing. This shows how to create a prediction and wait for the result in a production environment.
try:# Create predictionprediction_id = create_prediction()print(f"Prediction created: {prediction_id}")# Get resultresult = get_prediction(prediction_id)print(f"Output URL: {result['output']}")print(f"Processing time: {result['metrics']['predict_time']}s")except Exception as e:print(f"Error: {e}")
Additional Information
- The API uses a two-step process: create prediction and poll for results
- Response time: ~7 seconds
- Rate limit: 60 requests/minute
- Concurrent requests: 10 maximum
- Use long-polling to check prediction status until completion
Overview
PixArt XL 2 is a diffusion-transformer-based text-to-image generative model developed by PixArt-alpha. It can directly generate high-resolution 1024x1024 pixel images from textual prompts in a single sampling process.
Technical Specifications
Architecture: Combines diffusion and transformer models for text-to-image generation.
Resolution: Generates images at 1024x1024 pixels in a single pass.
Encoders: Utilizes a pretrained T5 text encoder and a VAE latent feature encoder.
Training Efficiency: Achieves high-resolution outputs with optimized training time and resource utilization.
Key Considerations
Input Specificity: Vague prompts may lead to less accurate or unintended image outputs.
Negative Prompts: Omitting negative prompts can result in the inclusion of unwanted elements.
Style Compatibility: Ensure the selected style aligns with the content of the prompt for coherent results.
Tips & Tricks
Prompt for PixArt XL 2: Use detailed descriptions to guide the PixArt XL 2 effectively. For example, "A serene sunset over a mountain range with a clear sky" provides clear guidance.
Negative Prompt: Specify elements to exclude, such as "no people" or "no text," to prevent their inclusion in the image.
Style: Select from options like Cinematic, Photographic, Anime, Manga, Digital Art, Pixel Art, Fantasy Art, Neonpunk, or 3D Model to match your desired aesthetic.
Width and Height: Set both to 1024 for full-resolution images. For smaller outputs, adjust accordingly.
Number of Outputs: Start with 1 to evaluate results before generating multiple variations.
Scheduler: Experiment with options like DDIM, DPMSolverMultistep, HeunDiscrete, KarrasDPM, K_EULER_ANCESTRAL, K_EULER, or PNDM to find the best fit for your needs.
Inference Steps: A range of 50-100 steps often balances quality and performance.
Guidance Scale: Values between 7.5 and 15 can enhance adherence to the prompt without over-constraining the PixArt XL 2.
Seed: Set a specific seed value for reproducibility or leave it random for varied outputs.
Capabilities
Art and Design: Creating unique visuals for artistic and design purposes with PixArt XL 2.
Educational Materials: Producing illustrative content for educational use.
Entertainment: Generating imagery for media and entertainment projects.
What can I use for?
Creative Projects: Develop artwork, illustrations, and concept designs.
Visualization: Create visual representations of textual descriptions for presentations or educational content.
Inspiration: Generate images to inspire creative ideas and concepts.
Things to be aware of
Style Exploration: Experiment with different styles to see how the same prompt is rendered across various aesthetics.
Prompt Variations: Modify prompts slightly to observe how changes affect the output.
Negative Prompts: Use negative prompts to refine images by excluding certain elements.
Limitations
Content Accuracy: The PixArt XL 2 may not always capture complex or abstract concepts accurately.
Style Limitations: Some styles may not render certain subjects effectively.
Resource Intensive: Generating high-resolution images with many inference steps can be computationally demanding.
Output Format: PNG