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, use_spot: bool | None = None, spot_fallback: bool | 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".use_spot(bool | None, optional):Truetrains on spot capacity (cheaper; when it is reclaimed, training resumes from its last checkpoint).spot_fallback(bool | None, optional): Withuse_spot:True(the API's default) falls back to on-demand capacity when no spot is available;Falsewaits for spot.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) -> AIModel
Deploy the fine-tuned model from a completed job as a self-hosted model.
Returns the model it made (the request is accepted, 202); poll
client.ai.models.status until it is running.
Parameters
job_id(str): The fine-tuning job ID.**kwargs(Any): Deployment parameters, written Pythonically:deployment_name(required),gpu_type,tensor_parallel_size,scheduling, anduse_spot(run on spot capacity) withspot_fallback(True, the API's default, falls back to on-demand when spot is unavailable;Falsewaits for spot).
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.).
job_status
job_status(job_id: str) -> dict[str, Any]
Get a fine-tuning job's lifecycle status, synced live from the gateway.
Parameters
job_id(str): The fine-tuning job ID.
Returns
dict[str, Any]:job_id,status,phase(its status message),progress,error,started_at,completed_atandupdated_at.
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).
model_requirements
model_requirements(base_model: str, *, method: str | None = None) -> dict[str, Any]
Get the hardware and VRAM a base model needs to be fine-tuned.
Parameters
base_model(str): The base model id (frombase_models).method(str | None, optional): A training method (lora,qlora,full) for its own requirements.
recommend
recommend(base_model: str, *, use_case: str | None = None, dataset_size: int | None = None) -> dict[str, Any]
Get a recommended configuration (method, hyperparameters, hardware) for a base model.
Parameters
base_model(str): The base model id (frombase_models).use_case(str | None, optional): The intended use:chat(the platform's default),instruction,classificationand so on.dataset_size(int | None, optional): The number of training examples.
restart_job
restart_job(job_id: str) -> FineTuningJob
Restart a fine-tuning job; returns the 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) -> FineTuningJob
Stop a running fine-tuning job; returns the job.
validate_config
validate_config(base_model: str, *, method: str, hardware: Mapping[str, Any] | None = None, method_config: Mapping[str, Any] | None = None) -> dict[str, Any]
Check a fine-tuning configuration before create_job.
Parameters
base_model(str): The base model id.method(str): The training method:lora,qloraorfull.hardware(Mapping[str, Any] | None, optional): The target hardware, e.g.{"gpu_type": "A100", "gpu_count": 1}.method_config(Mapping[str, Any] | None, optional): Method settings, e.g.{"bits": 4}for qlora.
Returns
dict[str, Any]:valid,errorsandwarnings.