Fine-Tuning
Fine-Tuning manages training jobs that adapt a base model to your data. Use this resource to create and monitor jobs, stream events, and deploy the resulting model.
Access it as client.fine_tuning on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.
Methods
All methods
base_models
base_models() -> List[Dict[str, Any]]
Get available base models for fine-tuning.
create_job
create_job(*, name: str, base_model: str, training_dataset: str, description: Optional[str] = None, validation_file: Optional[str] = None, hyperparameters: Optional[Mapping[str, Any]] = None, suffix: Optional[str] = None) -> FineTuningJob
Create a new fine-tuning job.
Args: name: Job name. base_model: Base model to fine-tune. training_dataset: Training dataset id or path. description: Optional description. validation_file: Validation dataset id or path. hyperparameters: Free-form hyperparameter overrides. suffix: Suffix for the resulting model name.
job = client.fine_tuning.create_job(
name="support-bot-ft",
base_model="meta-llama/Llama-3.1-8B",
training_dataset="dataset_abc123",
hyperparameters={"epochs": 3, "learning_rate": 2e-5},
)
delete_job
delete_job(job_id: str) -> None
Delete a fine-tuning job.
deploy_model
deploy_model(job_id: str, **kwargs) -> Dict[str, Any]
Deploy the fine-tuned model from a completed job.
Args: job_id: The fine-tuning job ID. **kwargs: Additional deployment parameters.
estimate_cost
estimate_cost(*, base_model: str, dataset_size: int, **kwargs) -> FineTuningCostEstimate
Estimate the cost of a fine-tuning job.
Args: base_model: The base model to fine-tune. dataset_size: Size of the training dataset. **kwargs: Additional parameters forwarded to the API.
hardware
hardware() -> List[Dict[str, Any]]
Get available hardware options for fine-tuning.
job_logs
job_logs(job_id: str, *, lines: Optional[int] = None, since: Optional[str] = None) -> Dict[str, Any]
Get fine-tuning job logs.
Args: job_id: The fine-tuning job ID. lines: Number of log lines to return. since: ISO date string; return logs since this time.
job_metrics
job_metrics(job_id: str) -> Dict[str, Any]
Get fine-tuning job metrics (loss, accuracy, etc.).
list_jobs
list_jobs(*, status: Optional[str] = None, base_model: Optional[str] = None, search: Optional[str] = None, limit: Optional[int] = None) -> SyncPaginator[FineTuningJob]
List fine-tuning jobs with pagination and filtering.
Args: status: Filter by job status. base_model: Filter by base model name. search: Search by name, description, or base model. limit: Maximum number of items to return (default: all matching items).
restart_job
restart_job(job_id: str) -> Dict[str, Any]
Restart a fine-tuning job.
retrieve_job
retrieve_job(job_id: str) -> FineTuningJob
Get a single fine-tuning job by ID.
stats
stats() -> FineTuningStats
Get fine-tuning overview stats.
stop_job
stop_job(job_id: str) -> Dict[str, Any]
Stop a running fine-tuning job.