Skip to content

Latest commit

 

History

History
232 lines (154 loc) · 34.3 KB

File metadata and controls

232 lines (154 loc) · 34.3 KB

FineTuning.Jobs

Overview

Available Operations

  • list - Get Fine Tuning Jobs
  • create - Create Fine Tuning Job
  • get - Get Fine Tuning Job
  • cancel - Cancel Fine Tuning Job
  • start - Start Fine Tuning Job

list

Get a list of fine-tuning jobs for your organization and user.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.fine_tuning.jobs.list(page=0, page_size=100, created_by_me=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
page Optional[int] The page number of the results to be returned.
page_size Optional[int] The number of items to return per page.
model OptionalNullable[str] The model name used for fine-tuning to filter on. When set, the other results are not displayed.
created_after date The date/time to filter on. When set, the results for previous creation times are not displayed.
created_before date N/A
created_by_me Optional[bool] When set, only return results for jobs created by the API caller. Other results are not displayed.
status OptionalNullable[models.JobsAPIRoutesFineTuningGetFineTuningJobsStatus] The current job state to filter on. When set, the other results are not displayed.
wandb_project OptionalNullable[str] The Weights and Biases project to filter on. When set, the other results are not displayed.
wandb_name OptionalNullable[str] The Weight and Biases run name to filter on. When set, the other results are not displayed.
suffix OptionalNullable[str] The model suffix to filter on. When set, the other results are not displayed.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListFineTuningJobsResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

create

Create a new fine-tuning job, it will be queued for processing.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.fine_tuning.jobs.create(model="Camaro", hyperparameters={
        "learning_rate": 0.0001,
    }, invalid_sample_skip_percentage=0)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
model str ✔️ N/A
hyperparameters models.Hyperparameters ✔️ N/A
training_files List[models.TrainingFile] N/A
validation_files List[str] A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in checkpoints when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files.
suffix OptionalNullable[str] A string that will be added to your fine-tuning model name. For example, a suffix of "my-great-model" would produce a model name like ft:open-mistral-7b:my-great-model:xxx...
integrations List[models.CreateFineTuningJobRequestIntegration] A list of integrations to enable for your fine-tuning job.
auto_start Optional[bool] This field will be required in a future release.
invalid_sample_skip_percentage Optional[float] N/A
job_type OptionalNullable[models.FineTuneableModelType] N/A
repositories List[models.CreateFineTuningJobRequestRepository] N/A
classifier_targets List[models.ClassifierTarget] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.JobsAPIRoutesFineTuningCreateFineTuningJobResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get

Get a fine-tuned job details by its UUID.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.fine_tuning.jobs.get(job_id="c167a961-ffca-4bcf-93ac-6169468dd389")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
job_id str ✔️ The ID of the job to analyse.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.JobsAPIRoutesFineTuningGetFineTuningJobResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

cancel

Request the cancellation of a fine tuning job.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.fine_tuning.jobs.cancel(job_id="6188a2f6-7513-4e0f-89cc-3f8088523a49")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
job_id str ✔️ The ID of the job to cancel.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.JobsAPIRoutesFineTuningCancelFineTuningJobResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

start

Request the start of a validated fine tuning job.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.fine_tuning.jobs.start(job_id="56553e4d-0679-471e-b9ac-59a77d671103")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
job_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.JobsAPIRoutesFineTuningStartFineTuningJobResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*