§
    Ò¬¸j4;  ã                  ó’   — d dl mZ d dlmZmZmZ d dlZddlmZm	Z	m
Z
mZmZ ddlmZmZmZ  G d„ d¦  «        Z G d	„ d
¦  «        ZdS )é    )Úannotations)ÚAnyÚLiteralÚcastNé   )Ú	NOT_GIVENÚAsyncAPIClientÚNotGivenÚSyncAPIClientÚ_query_parameter)ÚTrainingGpuAvailabilityResponseÚTrainingMetricsResponseÚTrainingStartResponsec                  óV   — e Zd ZdZd%d„Zedddœd&d„Zeedddœd'd„Zeeedddœd(d$„ZdS ))ÚTrainingzTraining API operations.Úclientr   ÚreturnÚNonec                ó   — || _         d S ©N©Ú_client©Úselfr   s     úw/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/ultralytics_platform/resources/training.pyÚ__init__zTraining.__init__   ó   € ØˆŒˆˆó    N©ÚmanagedÚtimeoutÚextra_headersr    ú#Literal['true', 'false'] | NotGivenr!   úfloat | httpx.Timeout | Noner"   údict[str, str] | Noner   c               óŽ   — t          t          | j                             dd||dg t	          d|dd¬¦  «        ¢¬¦  «        ¦  «        S )	áš  Get GPU availability.

        Returns current cloud training capacity for each supported GPU type. Basic queries are public; `managed=true` additionally probes Ultralytics managed capacity and requires authentication.

        Args:
            managed (Literal["true", "false"], optional): Include managed training capacity
            timeout (float | httpx.Timeout, optional): Request timeout override.
            extra_headers (dict[str, str], optional): Additional request headers.

        Returns:
            (TrainingGpuAvailabilityResponse): The API response.

        Raises:
            (APIError): If the API returns an unsuccessful response.
        ÚGETú/api/training/gpu-availability©ÚAuthorizationzBearer r    ÚformT©ÚstyleÚexplode©r!   r"   ÚauthÚparams©r   r   r   Úrequestr   ©r   r    r!   r"   s       r   Úgpu_availabilityzTraining.gpu_availability   s]   € õ, Ý+ØŒL× Ò ØØ0ØØ+Ø1ØZÕ)¨)°WÀFÐTXÐYÑYÔYÐZð !ñ ô ñ

ô 

ð 
	
r   ©Úgpu_typeÚcapture_dataset_versionr!   r"   Úmodel_idÚstrÚ
train_argsúdict[str, Any]r8   áY  Literal['rtx-2000-ada', 'rtx-a4500', 'rtx-a5000', 'rtx-4000-ada', 'l4', 'a40', 'rtx-3090', 'rtx-a6000', 'rtx-pro-4000', 'rtx-pro-4500', 'rtx-4090', 'rtx-6000-ada', 'l40s', 'rtx-pro-5000', 'rtx-5090', 'l40', 'a100-80gb-pcie', 'a100-80gb-sxm', 'rtx-pro-6000', 'h100-pcie', 'h100-nvl', 'h100-sxm', 'h200-nvl', 'h200-sxm', 'b200', 'b300'] | NotGivenr9   úbool | NotGivenr   c               ór   — t          t          | j                             dd||d||||dœ¬¦  «        ¦  «        S )áJ  Start cloud training.

        Launches YOLO training on a cloud GPU. Training costs are deducted from your credit balance based on GPU type and duration.

        Args:
            model_id (str): Model ID to train
            gpu_type (Literal["rtx-2000-ada", "rtx-a4500", "rtx-a5000", "rtx-4000-ada", "l4", "a40", "rtx-3090", "rtx-a6000", "rtx-pro-4000", "rtx-pro-4500", "rtx-4090", "rtx-6000-ada", "l40s", "rtx-pro-5000", "rtx-5090", "l40", "a100-80gb-pcie", "a100-80gb-sxm", "rtx-pro-6000", "h100-pcie", "h100-nvl", "h100-sxm", "h200-nvl", "h200-sxm", "b200", "b300"], optional): Cloud GPU to use
            capture_dataset_version (bool, optional): Save an immutable dataset version for this run
            train_args (dict[str, Any]): YOLO training arguments
            timeout (float | httpx.Timeout, optional): Request timeout override.
            extra_headers (dict[str, str], optional): Additional request headers.

        Returns:
            (TrainingStartResponse): The API response.

        Raises:
            (APIError): If the API returns an unsuccessful response.
        ÚPOSTú/api/training/startr*   ©ÚmodelIdÚgpuTypeÚcaptureDatasetVersionÚ	trainArgs©r!   r"   r1   Újson©r   r   r   r4   ©r   r:   r<   r8   r9   r!   r"   s          r   ÚstartzTraining.start?   sY   € õp Ý!ØŒL× Ò ØØ%ØØ+Ø1à'Ø'Ø-DØ!+ð	ð ð !ñ ô ñ
ô 
ð 	
r   ©r:   ÚprojectÚnamer!   r"   Úeventú�Literal['training_started', 'training_progress', 'epoch_end', 'system_metrics', 'console_output', 'checkpoint_saved', 'training_complete', 'training_failed']Údataústr | NotGivenrO   rP   r   c               ót   — t          t          | j                             dd||d|||||dœ¬¦  «        ¦  «        S )á=  Send a training event.

        Receives callbacks from an existing training process; does not provision compute. For initial training_started registration, supply project and optionally name (defaults to train); an existing username prefix selects that workspace and requires editor access; other paths belong to the caller. Retain the returned modelId, runId, and modelSlug; send modelId on subsequent events. Honor cancelled=true responses. checkpoint_saved promotes an uploaded checkpoint only for its runId. This contract covers Bearer API-key callbacks, including assigned workers. Existing signed cloud callbacks instead use X-Alpha-Job-Id (model ID) and X-Alpha-Signature (HMAC-SHA256 of the exact request body with the job webhook secret).

        Args:
            model_id (str, optional): modelId request value.
            project (str, optional): project request value.
            name (str, optional): name request value.
            event (Literal["training_started", "training_progress", "epoch_end", "system_metrics", "console_output", "checkpoint_saved", "training_complete", "training_failed"]): event request value.
            data (dict[str, Any]): Event-specific callback data, preserving original field names and nested values. training_started: trainArgs, epochs, device, environment, modelInfo. epoch_end: epoch, metrics, system, fitness, modelInfo, total_epochs or epochs_total. system_metrics: cpu, memory, disk, diskIo, network, gpus. console_output: content, lineCount, chunkId, progress. checkpoint_saved: runId, modelPath (the upload response gcsPath), uploadPath. training_complete: runId, results, classNames, plots. training_failed: error, code, instanceId. training_progress: liveness data. Worker callbacks include runId when available.
            timeout (float | httpx.Timeout, optional): Request timeout override.
            extra_headers (dict[str, str], optional): Additional request headers.

        Returns:
            (TrainingMetricsResponse): The API response.

        Raises:
            (APIError): If the API returns an unsuccessful response.
        rB   ú/api/webhooks/training/metricsr*   ©rE   rO   rP   rQ   rS   rI   ©r   r   r   r4   ©r   rQ   rS   r:   rO   rP   r!   r"   s           r   ÚmetricszTraining.metricsˆ   sV   € õN Ý#ØŒL× Ò ØØ0ØØ+Ø1Ø!)°gÀtÐV[ÐeiÐjÐjð !ñ ô ñ

ô 

ð 
	
r   )r   r   r   r   ©r    r#   r!   r$   r"   r%   r   r   ©r:   r;   r<   r=   r8   r>   r9   r?   r!   r$   r"   r%   r   r   ©rQ   rR   rS   r=   r:   rT   rO   rT   rP   rT   r!   r$   r"   r%   r   r   ©	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r6   rM   r[   © r   r   r   r      s¼   € € € € € Ø"Ð"ðð ð ð ð 8AØ04Ø/3ð 
ð  
ð  
ð  
ð  
ð  
ðF Ø3<Ø04Ø/3ðIG
ð G
ð G
ð G
ð G
ð G
ðn $-Ø"+Ø(Ø04Ø/3ð%1
ð 1
ð 1
ð 1
ð 1
ð 1
ð 1
ð 1
r   r   c                  óV   — e Zd ZdZd%d„Zedddœd&d„Zeedddœd'd„Zeeedddœd(d$„ZdS ))ÚAsyncTrainingz%Asynchronous Training API operations.r   r	   r   r   c                ó   — || _         d S r   r   r   s     r   r   zAsyncTraining.__init__¿   r   r   Nr   r    r#   r!   r$   r"   r%   r   c             ƒ  óž   K  — t          t          | j                             dd||dg t	          d|dd¬¦  «        ¢¬¦  «        ƒ d	{V —†¦  «        S )
r'   r(   r)   r*   r    r,   Tr-   r0   Nr3   r5   s       r   r6   zAsyncTraining.gpu_availabilityÂ   s   è è € õ, Ý+Ø”,×&Ò&ØØ0ØØ+Ø1ØZÕ)¨)°WÀFÐTXÐYÑYÔYÐZð 'ñ ô ð ð ð ð ð ð ñ

ô 

ð 
	
r   r7   r:   r;   r<   r=   r8   r>   r9   r?   r   c             ƒ  ó‚   K  — t          t          | j                             dd||d||||dœ¬¦  «        ƒ d{V —†¦  «        S )rA   rB   rC   r*   rD   rI   NrK   rL   s          r   rM   zAsyncTraining.startä   s{   è è € õp Ý!Ø”,×&Ò&ØØ%ØØ+Ø1à'Ø'Ø-DØ!+ð	ð ð 'ñ ô ð ð ð ð ð ð ñ
ô 
ð 	
r   rN   rQ   rR   rS   rT   rO   rP   r   c             ƒ  ó„   K  — t          t          | j                             dd||d|||||dœ¬¦  «        ƒ d{V —†¦  «        S )rV   rB   rW   r*   rX   rI   NrY   rZ   s           r   r[   zAsyncTraining.metrics-  sx   è è € õN Ý#Ø”,×&Ò&ØØ0ØØ+Ø1Ø!)°gÀtÐV[ÐeiÐjÐjð 'ñ ô ð ð ð ð ð ð ñ

ô 

ð 
	
r   )r   r	   r   r   r\   r]   r^   r_   rd   r   r   rf   rf   ¼   s¼   € € € € € Ø/Ð/ðð ð ð ð 8AØ04Ø/3ð 
ð  
ð  
ð  
ð  
ð  
ðF Ø3<Ø04Ø/3ðIG
ð G
ð G
ð G
ð G
ð G
ðn $-Ø"+Ø(Ø04Ø/3ð%1
ð 1
ð 1
ð 1
ð 1
ð 1
ð 1
ð 1
r   rf   )Ú
__future__r   Útypingr   r   r   Úhttpxr   r   r	   r
   r   r   Útypesr   r   r   r   rf   rd   r   r   ú<module>ro      s%  ðð #Ð "Ð "Ð "Ð "Ð "à %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à €€€ðð ð ð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ðb
ð b
ð b
ð b
ð b
ñ b
ô b
ð b
ðJb
ð b
ð b
ð b
ð b
ñ b
ô b
ð b
ð b
ð b
r   