p-image-edit-trainer
Train custom LoRAs for image editing transformations
p-image-edit-trainer allows you to train custom LoRA (Low-Rank Adaptation) weights for use with the p-image-edit-lora model. Train personalized image transformations, style transfers, and custom editing behaviors using pairs of before/after images.
This is NOT an inference model. It does not edit images. Instead, it outputs a ZIP file containing trained LoRA weights (.safetensors).
Rate Limit: 5 requests per minute
Category: LoRA Training
Price: $4.00 / 1000 steps
Important Notes:
- Async only - Training takes minutes to hours. Do not use
Try-Syncheader. - Download within 30 minutes - The output URL expires approximately 30 minutes after training completes. Download immediately and upload to HuggingFace for permanent storage.
- Trained LoRAs only work with
p-image-edit-lora, not with other models.
Workflow
Section titled “Workflow”- Prepare image pairs - Create a ZIP file with before/after image pairs using
_start/_endnaming - Upload ZIP to accessible URL - Host your training data somewhere accessible
- Start training - Submit async request (takes minutes to hours)
- Poll for completion - Check status until training succeeds
- Download output - Get the ZIP file within 30 minutes
- Upload to HuggingFace - Store the .safetensors file for permanent access
- Use with p-image-edit-lora - Edit images using your trained LoRA
Quickstart
Section titled “Quickstart”Prepare Training Data (Image Pairs)
Section titled “Prepare Training Data (Image Pairs)”Create a ZIP archive with before/after image pairs. Images must follow the _start/_end naming convention:
training_data.zip├── photo_start.jpg # Before image├── photo_end.jpg # After image (transformed)├── photo.txt # Optional: caption describing the transformation├── landscape_start.png # Another before image├── landscape_end.png # Corresponding after image├── landscape.txt # Optional: caption└── ...Naming Convention:
- Before image:
<ROOT>_start.<EXT> - After image:
<ROOT>_end.<EXT> - Caption (optional):
<ROOT>.txt
Multiple Reference Images (Optional): For complex transformations, you can include multiple "before" references:
example_start.jpg # Primary before imageexample_start2.jpg # Additional referenceexample_start3.jpg # Additional referenceexample_end.jpg # After imageexample.txt # CaptionStart Training (Async Only)
Section titled “Start Training (Async Only)”curl -X POST 'https://api.pruna.ai/v1/predictions' \ -H 'Content-Type: application/json' \ -H 'apikey: YOUR_API_KEY' \ -H 'Model: p-image-edit-trainer' \ -d '{ "input": { "image_data": "https://your-storage.com/edit_pairs.zip", "steps": 1000, "default_caption": "apply the trained transformation" } }'Response:
{ "id": "training456xyz", "model": "p-image-edit-trainer", "input": { ... }, "get_url": "https://api.pruna.ai/v1/predictions/status/training456xyz"}Poll for Completion
Section titled “Poll for Completion”Training takes minutes to hours depending on steps. Poll periodically:
curl -X GET 'https://api.pruna.ai/v1/predictions/status/training456xyz' \ -H 'apikey: YOUR_API_KEY'When complete:
{ "status": "succeeded", "output": "https://api.pruna.ai/v1/predictions/delivery/xezq/abc123.../lora_weights.zip"}Download Output Immediately
Section titled “Download Output Immediately”The output URL expires in ~30 minutes. Download the ZIP file immediately:
curl -o lora_output.zip "https://api.pruna.ai/v1/predictions/delivery/xezq/abc123.../lora_weights.zip"Upload to HuggingFace
Section titled “Upload to HuggingFace”Extract and upload the .safetensors file to HuggingFace:
unzip lora_output.zip# Upload lora.safetensors to huggingface.co/your-username/my-edit-loraUse with p-image-edit-lora
Section titled “Use with p-image-edit-lora”curl -X POST 'https://api.pruna.ai/v1/predictions' \ -H 'Content-Type: application/json' \ -H 'apikey: YOUR_API_KEY' \ -H 'Model: p-image-edit-lora' \ -d '{ "input": { "prompt": "Apply the trained transformation to image 1", "images": ["https://example.com/input.jpg"], "lora_weights": "huggingface.co/your-username/my-edit-lora" } }'Parameters
Section titled “Parameters”Required Parameters
Section titled “Required Parameters”| Parameter | Type | Description |
|---|---|---|
| image_data | string (URI) | URL to a ZIP archive with image pairs. Images must be named ROOT_start.EXT and ROOT_end.EXT. Can include multiple references (ROOT_start2.EXT, etc.) and text files for captions (ROOT.txt) |
Optional Parameters
Section titled “Optional Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
| steps | integer | 1000 | Number of training steps. Range: 100-5000, in increments of 100. More steps = longer training, potentially better results |
| learning_rate | number | 0.0001 | Learning rate for training. Range: 0.00001-0.01. Lower = slower but more stable |
| default_caption | string | - | Default caption for image pairs without .txt files. If not provided and captions are missing, training fails |
Steps Guidelines
Section titled “Steps Guidelines”| Steps | Use Case | Expected Time |
|---|---|---|
| 100-500 | Quick tests, simple transforms | Minutes |
| 500-1000 | Standard training | 10-30 minutes |
| 1000-2000 | High quality, complex transforms | 30-60 minutes |
| 2000-5000 | Maximum quality | 1-2+ hours |
Example Use Cases
Section titled “Example Use Cases”| Transformation Type | Training Data Example |
|---|---|
| Style transfer | Photos paired with artistic renditions |
| Day-to-night | Daytime scenes paired with nighttime versions |
| Season changes | Summer scenes paired with winter versions |
| Enhancement filters | Original images paired with enhanced versions |
| Custom effects | Before/after pairs showing your custom transformation |