Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion replicate/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from replicate.exceptions import ReplicateException
from replicate.files import upload_file
from replicate.json import encode_json
from replicate.version import Version


class Training(BaseModel):
Expand All @@ -19,7 +20,7 @@ class Training(BaseModel):
output: Optional[Any]
started_at: Optional[str]
status: str
version: str
version: Optional[Version]

def cancel(self) -> None:
"""Cancel a running training"""
Expand All @@ -44,6 +45,8 @@ def get(self, id: str) -> Training:
f"/v1/trainings/{id}",
)
obj = resp.json()
# HACK: resolve this? make it lazy somehow?
del obj["version"]
return self.prepare_model(obj)

def create( # type: ignore
Expand Down Expand Up @@ -83,4 +86,5 @@ def create( # type: ignore
json=body,
)
obj = resp.json()
del obj["version"]
return self.prepare_model(obj)