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, volume_id: str | None = None, data_version: int | None = None, url_volume_id: str | None = None, output_volume_id: str | None = None, output_volume_name: str | None = None, description: str | None = None, validation_file: str | None = None, dataset_format: str | None = None, epochs: int | None = None, batch_size: int | None = None, training_method: str | None = None, learning_rate: float | None = None, gpu_count: int | None = None, gpu_type: str | None = None, hyperparameters: Mapping[str, Any] | None = None, suffix: str | None = None) -> FineTuningJob
Create a new fine-tuning job.
The trained model is written to a shared volume: an existing one
(output_volume_id) or a new one the platform creates
(output_volume_name). Give exactly one.
Parameters
name(str): Job name.base_model(str): Base HuggingFace model to fine-tune (self-hosted only).training_dataset(str): The training dataset: anhf://org/datasetid, an https URL (withurl_volume_id), or, withvolume_id, a file's path in that shared volume's data half (a file uploaded there, or a Data Forge export). Anhf://id is read from the HuggingFace Hub with the job owner's HuggingFace token (Profile > Integrations > HuggingFace Token), both when it is validated and when it is trained on; a gated or private dataset needs that token with access granted on huggingface.co.volume_id(str | None, optional): The shared volume whose data half holdstraining_dataset: your own shared volume or one shared with you (an unshared project volume stays in its project).data_version(int | None, optional): The volume data version to read the file at (default: latest).url_volume_id(str | None, optional): For an httpstraining_dataset: the shared volume (one you may write) the file is fetched into before the job reads it.output_volume_id(str | None, optional): The shared volume the trained model is written to, one you may write. Give this oroutput_volume_name.output_volume_name(str | None, optional): The name of a new shared volume to create for the trained model.description(str | None, optional): Optional description.validation_file(str | None, optional): Validation dataset id or path.dataset_format(str | None, optional): Dataset format, e.g."chatml"(Data Forge exports),"alpaca","sharegpt", or"jsonl". If omitted the trainer expects instruction/output JSONL.epochs(int | None, optional): Number of training epochs.batch_size(int | None, optional): Per-device training batch size.training_method(str | None, optional):"lora"(default) or"qlora".learning_rate(float | None, optional): Learning rate (e.g.2e-4).gpu_count(int | None, optional): GPUs to allocate for training; 0 (the default) trains on a CPU node.gpu_type(str | None, optional): GPU type, e.g."nvidia-t4"or"nvidia-a100".hyperparameters(Mapping[str, Any] | None, optional): Free-form extra trainer overrides, merged into the training config (e.g.{"weight_decay": 0.01}).suffix(str | None, optional): Suffix for the resulting model name.
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.
Parameters
job_id(str): The fine-tuning job ID.**kwargs(Any): Additional deployment parameters.
hardware
hardware() -> list[dict[str, Any]]
Get available hardware options for fine-tuning.
job_logs
job_logs(job_id: str, *, log_type: str | None = None) -> dict[str, Any]
Get a fine-tuning job's logs from one source, oldest first.
Parameters
job_id(str): The fine-tuning job ID.log_type(str | None, optional): The logs' source:build,validation(the dataset checks before training),training,deploy, orall. The platform readstrainingwhen none is given.
job_metrics
job_metrics(job_id: str) -> dict[str, Any]
Get fine-tuning job metrics (loss, accuracy, etc.).
list_jobs
list_jobs(*, status: str | None = None, base_model: str | None = None, search: str | None = None, limit: int | None = None) -> SyncPaginator[FineTuningJob]
List fine-tuning jobs with pagination and filtering.
Parameters
status(str | None, optional): Filter by job status.base_model(str | None, optional): Filter by base model name.search(str | None, optional): Search by name, description, or base model.limit(int | None, optional): 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.