翻篇收录说明
翻篇网页快照

Custom Model Training | Ideogram API Docs

https://developer.ideogram.ai/v1/tutorials/custom-model-training

最近抓取:2026-12-04 08:41:53(北京时间)

最近内容变化:2026-12-01 11:42:13(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Train a custom Ideogram model on your own images using datasets, then generate with your custom model URI.

正文摘录

Skip to navigationTrain a custom model on your own images, then use it to generate new images in that style. Overview Custom model training lets you fine-tune an Ideogram model on your own dataset of images. Once training completes, you can use the model with the Generate endpoint by passing its custom_model_uri. The workflow has four steps: Create a dataset to hold your training images. Upload images (and optional captions) to the dataset. Start training to kick off the model training job. Generate images using your trained model. A training run costs $40 at the API pricing rate and usually takes a few hours. Training uses the v1 endpoints below; to generate with the trained model you can also use POST /v2/image/generate/ideogram-3-custom-model. In the app, see Custom Models and its Training Tips. Step 1: Create a Dataset PythoncURLimport osimport requestsresponse = requests.post( "https://api.ideogram.ai/datasets", headers={"Api-Key": os.environ["IDEOGRAM_API_KEY"]}, json={"name": "My Training Dataset"})dataset = response.json()dataset_id = dataset["dataset_id"]print(f"Created dataset: {dataset_id}") Step 2: Upload Training Images Upload your training images to the dataset. You can upload individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, or ZIP archives containing both. A dataset needs at least 15 images, and can hold up to 100, to start training. A dataset can hold up to 100 images. Caption files are matched by filename stem (e.g. sunset.txt captions sunset.jpg). PythoncURLimport osimport requestsimport glob# Upload individual imagesfiles = [("files", open(f, "rb")) for f in glob.glob("training_images/*.jpg")]response = requests.post( f"https://api.ideogram.ai/datasets/{dataset_id}/upload_assets", headers={"Api-Key": os.environ["IDEOGRAM_API_KEY"]}, files=files)result = response.json()print(f"Uploaded {result['success_count']}/{result['total_count']} images") You can also upload a ZIP file containing images and captions together, which is convenient for larger datasets. Step 3: Train the Model Once your dataset has enough images, start training by giving your model a name. PythoncURLimport osimport requestsresponse = requests.post( "https://api.ideogram.ai/v1/ideogram-v3/train-model", headers={"Api-Key": os.environ["IDEOGRAM_API_KEY"]}, json={"dataset_id": dataset_id, "model_name": "my-custom-model"})training = response.json()model_id = training["model_id"]print(f"Training started: {training['training_status']}") Checking Training Status Poll the model details endpoint to check when training completes. PythoncURLimport osimport requestsimport timewhile True: response = requests.get( f"https://api.ideogram.ai/models/{model_id}", headers={"Api-Key": os.environ["IDEOGRAM_API_KEY"]} ) model = response.json()["model"] print(f"Status: {model['status']}") if model["status"] == "COMPLETED": print(f"Model ready. URI: {model.get('custom_model_uri')}") break elif model["status"] == "ERRORED": print("Training failed.") break time.sleep(60) Step 4: Generate with Your Model Once training is complete and is_available_for_generation is true, use the custom_model_uri from the model details to generate images. PythoncURLimport osimport requestsresponse = requests.post( "https://api.ideogram.ai/v1/ideogram-v3/generate", headers={"Api-Key": os.environ["IDEOGRAM_API_KEY"]}, files={ "prompt": (None, "A photo in my custom style"), "custom_model_uri": (None, "model/my-custom-model/version/1"), "rendering_speed": (None, "DEFAULT") })result = response.json()if response.status_code == 200: print(result["data"][0]["url"]) Tips for Better Results Use high-quality images that clearly represent the style or subject you want the model to learn. Add captions to guide the model on what each image represents. Captions are optional. Use consistent subjects across your training images so the style transfers consistently.