Skip to content

Commit 4ce0efa

Browse files
kunwar-vpgithub-actions[bot]
authored andcommitted
chore(spec): regenerate _generated/ from upstream openapi.yaml
1 parent 653ea81 commit 4ce0efa

5 files changed

Lines changed: 150 additions & 7 deletions

File tree

src/graphn/_generated/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
from .tts_request_response_format import TTSRequestResponseFormat
5050
from .validate_model_request import ValidateModelRequest
5151
from .validate_model_request_quantization import ValidateModelRequestQuantization
52+
from .validate_model_request_weight_source import ValidateModelRequestWeightSource
5253
from .validate_model_response import ValidateModelResponse
5354
from .validate_model_response_artifact_type import ValidateModelResponseArtifactType
5455
from .weight_source import WeightSource
@@ -101,6 +102,7 @@
101102
"TTSRequestResponseFormat",
102103
"ValidateModelRequest",
103104
"ValidateModelRequestQuantization",
105+
"ValidateModelRequestWeightSource",
104106
"ValidateModelResponse",
105107
"ValidateModelResponseArtifactType",
106108
"WeightSource",

src/graphn/_generated/models/custom_model.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from attrs import define as _attrs_define
88
from attrs import field as _attrs_field
9-
from dateutil.parser import isoparse
109

1110
from ..models.capability import Capability
1211
from ..models.custom_model_artifact_type import CustomModelArtifactType
@@ -317,9 +316,9 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
317316

318317
cooldown_seconds = d.pop("cooldown_seconds")
319318

320-
created_at = isoparse(d.pop("created_at"))
319+
created_at = datetime.datetime.fromisoformat(d.pop("created_at"))
321320

322-
updated_at = isoparse(d.pop("updated_at"))
321+
updated_at = datetime.datetime.fromisoformat(d.pop("updated_at"))
323322

324323
display_name = d.pop("display_name", UNSET)
325324

src/graphn/_generated/models/secret.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from attrs import define as _attrs_define
88
from attrs import field as _attrs_field
9-
from dateutil.parser import isoparse
109

1110
from ..types import UNSET, Unset
1211

@@ -87,9 +86,9 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
8786

8887
value_preview = d.pop("value_preview")
8988

90-
created_at = isoparse(d.pop("created_at"))
89+
created_at = datetime.datetime.fromisoformat(d.pop("created_at"))
9190

92-
updated_at = isoparse(d.pop("updated_at"))
91+
updated_at = datetime.datetime.fromisoformat(d.pop("updated_at"))
9392

9493
provider_id = d.pop("provider_id", UNSET)
9594

src/graphn/_generated/models/validate_model_request.py

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
from ..models.validate_model_request_quantization import (
99
ValidateModelRequestQuantization,
1010
)
11+
from ..models.validate_model_request_weight_source import (
12+
ValidateModelRequestWeightSource,
13+
)
1114
from ..types import UNSET, Unset
1215

1316
T = TypeVar("T", bound="ValidateModelRequest")
@@ -17,7 +20,34 @@
1720
class ValidateModelRequest:
1821
"""
1922
Attributes:
20-
huggingface_model_id (str):
23+
huggingface_model_id (str): Required when `weight_source` is `huggingface`. Carried
24+
through on the `s3_assume_role` path as the canonical
25+
model identifier (used for naming + LoRA classification
26+
hints), but architecture detection comes from `config.json`
27+
in the customer's bucket, not the HF Hub.
28+
weight_source (ValidateModelRequestWeightSource | Unset): Which validation path to run. `huggingface` (default)
29+
queries
30+
the HuggingFace Hub API. `s3_assume_role` chains the same
31+
two-hop AssumeRole the smart-loader uses (bootstrap user
32+
→ platform role → customer role with ExternalId) and
33+
probes `<s3_url>config.json` directly, so an unsupported
34+
architecture surfaces before AF provisions a download Job.
35+
`s3_presigned` is intentionally not accepted: presigned
36+
URLs deliver a single archive object and architecture
37+
detection requires the full extract.
38+
Default: ValidateModelRequestWeightSource.HUGGINGFACE.
39+
s3_url (None | str | Unset): S3 prefix (must end with `/`). Required when
40+
`weight_source` is `s3_assume_role`. Points at the
41+
directory containing `config.json` + safetensors in
42+
HuggingFace layout; the smart-loader uses `aws s3 sync`
43+
on this path so a single archive object is rejected at
44+
the API boundary.
45+
s3_role_arn (None | str | Unset): Customer IAM role ARN. Required when `weight_source` is
46+
`s3_assume_role`. Role name must start with `graphn-byom-`
47+
(the platform IAM is scoped to that prefix as
48+
defense-in-depth).
49+
s3_external_id (None | str | Unset): ExternalId from the customer's IAM trust policy. Required
50+
when `weight_source` is `s3_assume_role`.
2151
hf_token_secret_id (None | str | Unset): ID of a workspace secret holding a HuggingFace token.
2252
quantization (ValidateModelRequestQuantization | Unset):
2353
gpu_memory_utilization (float | Unset): Default: 0.9.
@@ -26,17 +56,57 @@ class ValidateModelRequest:
2656
from this hint instead of waiting for a HuggingFace head-bytes
2757
probe; useful for very large models where the probe would
2858
otherwise stall the validate response.
59+
base_model_id (None | str | Unset): LoRA base override / hint, mirroring
60+
`CustomModelCreate.base_model_id`. When the validator
61+
detects a LoRA adapter and this field is set, the
62+
override **wins** over
63+
`adapter_config.json::base_model_name_or_path` -- so the
64+
allowlist check and the base-model sizing probe both run
65+
against the override. Useful for adapters whose adapter
66+
config records a local filesystem path
67+
(e.g. `C:/users/.../base`) that isn't a valid HF id.
68+
Silently ignored when the validator resolves the repo as
69+
a full model (`artifact_type=base`).
2970
"""
3071

3172
huggingface_model_id: str
73+
weight_source: ValidateModelRequestWeightSource | Unset = (
74+
ValidateModelRequestWeightSource.HUGGINGFACE
75+
)
76+
s3_url: None | str | Unset = UNSET
77+
s3_role_arn: None | str | Unset = UNSET
78+
s3_external_id: None | str | Unset = UNSET
3279
hf_token_secret_id: None | str | Unset = UNSET
3380
quantization: ValidateModelRequestQuantization | Unset = UNSET
3481
gpu_memory_utilization: float | Unset = 0.9
3582
model_size_gb: int | None | Unset = UNSET
83+
base_model_id: None | str | Unset = UNSET
3684

3785
def to_dict(self) -> dict[str, Any]:
3886
huggingface_model_id = self.huggingface_model_id
3987

88+
weight_source: str | Unset = UNSET
89+
if not isinstance(self.weight_source, Unset):
90+
weight_source = self.weight_source.value
91+
92+
s3_url: None | str | Unset
93+
if isinstance(self.s3_url, Unset):
94+
s3_url = UNSET
95+
else:
96+
s3_url = self.s3_url
97+
98+
s3_role_arn: None | str | Unset
99+
if isinstance(self.s3_role_arn, Unset):
100+
s3_role_arn = UNSET
101+
else:
102+
s3_role_arn = self.s3_role_arn
103+
104+
s3_external_id: None | str | Unset
105+
if isinstance(self.s3_external_id, Unset):
106+
s3_external_id = UNSET
107+
else:
108+
s3_external_id = self.s3_external_id
109+
40110
hf_token_secret_id: None | str | Unset
41111
if isinstance(self.hf_token_secret_id, Unset):
42112
hf_token_secret_id = UNSET
@@ -55,13 +125,27 @@ def to_dict(self) -> dict[str, Any]:
55125
else:
56126
model_size_gb = self.model_size_gb
57127

128+
base_model_id: None | str | Unset
129+
if isinstance(self.base_model_id, Unset):
130+
base_model_id = UNSET
131+
else:
132+
base_model_id = self.base_model_id
133+
58134
field_dict: dict[str, Any] = {}
59135

60136
field_dict.update(
61137
{
62138
"huggingface_model_id": huggingface_model_id,
63139
}
64140
)
141+
if weight_source is not UNSET:
142+
field_dict["weight_source"] = weight_source
143+
if s3_url is not UNSET:
144+
field_dict["s3_url"] = s3_url
145+
if s3_role_arn is not UNSET:
146+
field_dict["s3_role_arn"] = s3_role_arn
147+
if s3_external_id is not UNSET:
148+
field_dict["s3_external_id"] = s3_external_id
65149
if hf_token_secret_id is not UNSET:
66150
field_dict["hf_token_secret_id"] = hf_token_secret_id
67151
if quantization is not UNSET:
@@ -70,6 +154,8 @@ def to_dict(self) -> dict[str, Any]:
70154
field_dict["gpu_memory_utilization"] = gpu_memory_utilization
71155
if model_size_gb is not UNSET:
72156
field_dict["model_size_gb"] = model_size_gb
157+
if base_model_id is not UNSET:
158+
field_dict["base_model_id"] = base_model_id
73159

74160
return field_dict
75161

@@ -78,6 +164,40 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
78164
d = dict(src_dict)
79165
huggingface_model_id = d.pop("huggingface_model_id")
80166

167+
_weight_source = d.pop("weight_source", UNSET)
168+
weight_source: ValidateModelRequestWeightSource | Unset
169+
if isinstance(_weight_source, Unset):
170+
weight_source = UNSET
171+
else:
172+
weight_source = ValidateModelRequestWeightSource(_weight_source)
173+
174+
def _parse_s3_url(data: object) -> None | str | Unset:
175+
if data is None:
176+
return data
177+
if isinstance(data, Unset):
178+
return data
179+
return cast(None | str | Unset, data)
180+
181+
s3_url = _parse_s3_url(d.pop("s3_url", UNSET))
182+
183+
def _parse_s3_role_arn(data: object) -> None | str | Unset:
184+
if data is None:
185+
return data
186+
if isinstance(data, Unset):
187+
return data
188+
return cast(None | str | Unset, data)
189+
190+
s3_role_arn = _parse_s3_role_arn(d.pop("s3_role_arn", UNSET))
191+
192+
def _parse_s3_external_id(data: object) -> None | str | Unset:
193+
if data is None:
194+
return data
195+
if isinstance(data, Unset):
196+
return data
197+
return cast(None | str | Unset, data)
198+
199+
s3_external_id = _parse_s3_external_id(d.pop("s3_external_id", UNSET))
200+
81201
def _parse_hf_token_secret_id(data: object) -> None | str | Unset:
82202
if data is None:
83203
return data
@@ -107,12 +227,26 @@ def _parse_model_size_gb(data: object) -> int | None | Unset:
107227

108228
model_size_gb = _parse_model_size_gb(d.pop("model_size_gb", UNSET))
109229

230+
def _parse_base_model_id(data: object) -> None | str | Unset:
231+
if data is None:
232+
return data
233+
if isinstance(data, Unset):
234+
return data
235+
return cast(None | str | Unset, data)
236+
237+
base_model_id = _parse_base_model_id(d.pop("base_model_id", UNSET))
238+
110239
validate_model_request = cls(
111240
huggingface_model_id=huggingface_model_id,
241+
weight_source=weight_source,
242+
s3_url=s3_url,
243+
s3_role_arn=s3_role_arn,
244+
s3_external_id=s3_external_id,
112245
hf_token_secret_id=hf_token_secret_id,
113246
quantization=quantization,
114247
gpu_memory_utilization=gpu_memory_utilization,
115248
model_size_gb=model_size_gb,
249+
base_model_id=base_model_id,
116250
)
117251

118252
return validate_model_request
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from enum import Enum
2+
3+
4+
class ValidateModelRequestWeightSource(str, Enum):
5+
HUGGINGFACE = "huggingface"
6+
S3_ASSUME_ROLE = "s3_assume_role"
7+
8+
def __str__(self) -> str:
9+
return str(self.value)

0 commit comments

Comments
 (0)