kumoai.trainer.TrainingJob#
- class kumoai.trainer.TrainingJob[source]#
Bases:
KumoFuture
[TrainingJobResult
]Represents an in-progress training job.
A
TrainingJob
object can either be created as the result offit()
withnon_blocking=True
, or directly with a training job ID (e.g. of a job created asynchronously in a different environment).import kumoai # See `Trainer` documentation: trainer = kumoai.Trainer(...) # If a Trainer is `fit` in nonblocking mode, the response will be of # type `TrainingJob`: training_job = trainer.fit(..., non_blocking=True) # You can also construct a `TrainingJob` from a job ID, e.g. one that # is present in the Kumo Jobs page: training_job = kumoai.TrainingJob("trainingjob-...") # Get the status of the job: print(training_job.status()) # Attach to the job, and poll progress updates: training_job.attach() # Training: 70%|█████████ | [300s<90s, trial=4, train_loss=1.056, val_loss=0.682, val_mae=35.709, val_mse=7906.239, val_rmse=88.917 # Cancel the job: training_job.cancel() # Wait for the job to complete, and return a `TrainingJobResult`: training_job.result()
- Parameters:
job_id (
str
) – The training job ID to await completion of.
- result()[source]#
Returns the resolved state of the future.
- Raises:
Exception – If the future is complete but in a failed state due to an exception being raised, this method will raise the same exception.
- Return type:
- future()[source]#
Returns the
concurrent.futures.Future
object wrapped by this future. It is not recommended to access this object directly.
- property tracking_url: str#
Returns a tracking URL pointing to the UI that can be used to monitor the status of an ongoing or completed job.
- attach()[source]#
Allows a user to attach to a running training job, and view its progress inline.
- Return type:
Example
>>> job_future = kumoai.TrainingJob(job_id="...") >>> job_future.attach() Attaching to training job <id>. To track this job... Training: 70%|█████████ | [300s<90s, trial=4, train_loss=1.056, val_loss=0.682, val_mae=35.709, val_mse=7906.239, val_rmse=88.917
- progress()[source]#
Returns the progress of an ongoing or completed training job.
- Return type:
AutoTrainerProgress
- cancel()[source]#
Cancels a running training job, and returns
True
if cancellation succeeded.- Return type:
Example
>>> job_future = kumoai.TrainingJob(job_id="...") >>> job_future.cancel()
- static __new__(cls, *args, **kwds)#
- done()#
Returns
True
if this future has been resolved withresult()
, orFalse
if this future is still in-progress. Note that this method will returnTrue
if the future is complete, but in a failed state, and that this method will returnFalse
if the job is complete, but the future has not been awaited.- Return type: