p-image-edit-trainer
Train custom LoRAs for image editing transformations
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:
Try-Sync header.p-image-edit-lora, not with other models._start/_end namingCreate 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:
<ROOT>_start.<EXT><ROOT>_end.<EXT><ROOT>.txtMultiple Reference Images (Optional): For complex transformations, you can include multiple "before" references:
example_start.jpg # Primary before image
example_start2.jpg # Additional reference
example_start3.jpg # Additional reference
example_end.jpg # After image
example.txt # Caption
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"
}
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"
}
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"
Extract and upload the .safetensors file to HuggingFace:
unzip lora_output.zip
# Upload lora.safetensors to huggingface.co/your-username/my-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"
}
}'
| 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) |
| 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 | 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 |
| 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 |