p-image-trainer
Train custom LoRAs for text-to-image generation
Train custom LoRAs for text-to-image generation
p-image-trainer allows you to train custom LoRA (Low-Rank Adaptation) weights for use with the p-image-lora model. Train personalized styles, subjects, characters, or concepts using your own images.
This is NOT an inference model. It does not generate images. Instead, it outputs a ZIP file containing trained LoRA weights (.safetensors).
Rate Limit: 5 requests per minute
Category: LoRA Training
Price: $1.80 / 1000 steps
Important Notes:
Try-Sync header.p-image-lora, not with other models.Create a ZIP archive with your training images:
training_data.zip
├── image1.jpg
├── image1.txt # Optional: caption for image1.jpg
├── image2.png
├── image2.txt # Optional: caption for image2.png
├── image3.jpg
└── ...
Use at least 10 images for good results. Caption files should match image names (e.g., photo.txt for photo.jpg).
curl -X POST 'https://api.pruna.ai/v1/predictions' \
-H 'Content-Type: application/json' \
-H 'apikey: YOUR_API_KEY' \
-H 'Model: p-image-trainer' \
-d '{
"input": {
"image_data": "https://your-storage.com/training_data.zip",
"steps": 1000,
"training_type": "balanced"
}
}'
Response:
{
"id": "training123xyz",
"model": "p-image-trainer",
"input": { ... },
"get_url": "https://api.pruna.ai/v1/predictions/status/training123xyz"
}
Training takes minutes to hours depending on steps. Poll periodically:
curl -X GET 'https://api.pruna.ai/v1/predictions/status/training123xyz' \
-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-lora
curl -X POST 'https://api.pruna.ai/v1/predictions' \
-H 'Content-Type: application/json' \
-H 'apikey: YOUR_API_KEY' \
-H 'Model: p-image-lora' \
-d '{
"input": {
"prompt": "A portrait in my custom style",
"lora_weights": "huggingface.co/your-username/my-lora"
}
}'
| Parameter | Type | Description |
|---|---|---|
| image_data | string (URI) | URL to a ZIP archive with training images. Use at least 10 images. Can include text files for captions (e.g., photo.txt for photo.jpg) |
| 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 |
| training_type | string | "balanced" | Type of training: "content" (subjects/characters), "style" (artistic styles), "balanced" (both) |
| default_caption | string | - | Default caption for images without .txt files. If not provided and captions are missing, training will fail |
| Type | Use Case |
|---|---|
| content | Specific subjects, characters, objects, people |
| style | Artistic styles, color palettes, aesthetic treatments |
| balanced | General-purpose, mixed content and style |
| Steps | Use Case | Expected Time |
|---|---|---|
| 100-500 | Quick tests, simple styles | Minutes |
| 500-1000 | Standard training | 10-30 minutes |
| 1000-2000 | High quality, complex | 30-60 minutes |
| 2000-5000 | Maximum quality | 1-2+ hours |