-
Notifications
You must be signed in to change notification settings - Fork 50
ENG-4782: prime train models — show FFT models by default #807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5b6eef3
e43f1e1
df0e626
489e1a9
a87ed28
7e01e99
b5ae42f
e0ac729
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,12 @@ | |
| token; admin role is gated server-side. | ||
| """ | ||
|
|
||
| from datetime import datetime | ||
| from typing import Any, Dict, List, Optional | ||
|
|
||
| from pydantic import BaseModel, ConfigDict, Field | ||
|
|
||
| from prime_cli.core import APIClient | ||
| from prime_cli.core import APIClient, APIError, NotFoundError, UnauthorizedError | ||
|
|
||
|
|
||
| class HostedTrainingRunResponse(BaseModel): | ||
|
|
@@ -30,6 +31,38 @@ class AvailableGpuTypesResponse(BaseModel): | |
| model_config = ConfigDict(populate_by_name=True) | ||
|
|
||
|
|
||
| class FFTModelClusterInfo(BaseModel): | ||
| """One cluster the caller can dispatch an FFT run to that already has | ||
| the parent model cached — mirrors the backend | ||
| `FFTModelClusterInfo` in `platform/backend/app/packages/training/schemas.py`. | ||
| """ | ||
|
|
||
| cluster_id: str = Field(..., alias="clusterId") | ||
| cluster_name: str = Field(..., alias="clusterName") | ||
| gpu_type: Optional[str] = Field(None, alias="gpuType") | ||
| cache_synced_at: Optional[datetime] = Field(None, alias="cacheSyncedAt") | ||
|
|
||
| model_config = ConfigDict(populate_by_name=True) | ||
|
|
||
|
|
||
| class AvailableFFTModel(BaseModel): | ||
| """A model that is cached and ready for FFT dispatch on at least one | ||
| eligible PrimeCluster.""" | ||
|
|
||
| name: str = Field(..., description="Model name") | ||
| clusters: List[FFTModelClusterInfo] = Field(default_factory=list) | ||
|
|
||
| model_config = ConfigDict(populate_by_name=True) | ||
|
|
||
|
|
||
| class AvailableFFTModelsResponse(BaseModel): | ||
| """Response from GET /v1/training/available-fft-models.""" | ||
|
|
||
| models: List[AvailableFFTModel] = Field(default_factory=list) | ||
|
|
||
| model_config = ConfigDict(populate_by_name=True) | ||
|
|
||
|
|
||
| class HostedTrainingClient: | ||
| """Client for the hosted full-FT training endpoint.""" | ||
|
|
||
|
|
@@ -71,6 +104,35 @@ def list_available_gpu_types(self, team_id: Optional[str] = None) -> AvailableGp | |
| response = self.client.get("/training/available-gpu-types", params=params) | ||
| return AvailableGpuTypesResponse.model_validate(response) | ||
|
|
||
| def list_available_fft_models(self, team_id: Optional[str] = None) -> List[AvailableFFTModel]: | ||
| """GET /v1/training/available-fft-models. Models that are already | ||
| cached on at least one PrimeCluster the caller can dispatch a | ||
| full-FT run to. | ||
|
|
||
| Returns an empty list when the caller has no eligible clusters | ||
| (403), when the endpoint is not deployed yet on the target | ||
| backend (404) or when auth is missing (401) — the CLI is called | ||
| in a "silent when empty" context alongside the LoRA listing and | ||
| should not crash the primary output on a still-rolling-out | ||
| endpoint. | ||
| """ | ||
| params: Dict[str, Any] = {} | ||
| if team_id: | ||
| params["team_id"] = team_id | ||
| try: | ||
| response = self.client.get("/training/available-fft-models", params=params) | ||
| except (NotFoundError, UnauthorizedError): | ||
| return [] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| except APIError as exc: | ||
| # 403 (not a team member) surfaces as APIError with an | ||
| # HTTP 403 prefix. Treat like NotFound so a personal caller | ||
| # querying with an unrelated team_id doesn't fail the whole | ||
| # command. | ||
| if "HTTP 403" in str(exc): | ||
| return [] | ||
| raise | ||
| return AvailableFFTModelsResponse.model_validate(response).models | ||
|
|
||
|
|
||
| def build_payload_from_toml( | ||
| cfg: Dict[str, Any], | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.