1111 overload ,
1212)
1313
14+ import pydantic
1415from typing_extensions import NotRequired , Unpack
1516
1617from replicate .helpers import async_encode_json , encode_json
2021from replicate .resource import Namespace , Resource
2122from replicate .version import Version
2223
23- try :
24- from pydantic import v1 as pydantic # type: ignore
25- except ImportError :
26- import pydantic # type: ignore
27-
2824if TYPE_CHECKING :
2925 from replicate .client import Client
3026 from replicate .file import FileEncodingStrategy
@@ -46,34 +42,34 @@ class Training(Resource):
4642 version : Union [str , Version ]
4743 """The version of the model used to create the training."""
4844
49- destination : Optional [str ]
45+ destination : Optional [str ] = None
5046 """The model destination of the training."""
5147
5248 status : Literal ["starting" , "processing" , "succeeded" , "failed" , "canceled" ]
5349 """The status of the training."""
5450
55- input : Optional [Dict [str , Any ]]
51+ input : Optional [Dict [str , Any ]] = None
5652 """The input to the training."""
5753
58- output : Optional [Any ]
54+ output : Optional [Any ] = None
5955 """The output of the training."""
6056
61- logs : Optional [str ]
57+ logs : Optional [str ] = None
6258 """The logs of the training."""
6359
64- error : Optional [str ]
60+ error : Optional [str ] = None
6561 """The error encountered during the training, if any."""
6662
67- created_at : Optional [str ]
63+ created_at : Optional [str ] = None
6864 """When the training was created."""
6965
70- started_at : Optional [str ]
66+ started_at : Optional [str ] = None
7167 """When the training was started."""
7268
73- completed_at : Optional [str ]
69+ completed_at : Optional [str ] = None
7470 """When the training was completed, if finished."""
7571
76- urls : Optional [Dict [str , str ]]
72+ urls : Optional [Dict [str , str ]] = None
7773 """
7874 URLs associated with the training.
7975
@@ -88,7 +84,7 @@ def cancel(self) -> None:
8884 """
8985
9086 canceled = self ._client .trainings .cancel (self .id )
91- for name , value in canceled .dict ().items ():
87+ for name , value in canceled .model_dump ().items ():
9288 setattr (self , name , value )
9389
9490 async def async_cancel (self ) -> None :
@@ -97,7 +93,7 @@ async def async_cancel(self) -> None:
9793 """
9894
9995 canceled = await self ._client .trainings .async_cancel (self .id )
100- for name , value in canceled .dict ().items ():
96+ for name , value in canceled .model_dump ().items ():
10197 setattr (self , name , value )
10298
10399 def reload (self ) -> None :
@@ -106,7 +102,7 @@ def reload(self) -> None:
106102 """
107103
108104 updated = self ._client .trainings .get (self .id )
109- for name , value in updated .dict ().items ():
105+ for name , value in updated .model_dump ().items ():
110106 setattr (self , name , value )
111107
112108 async def async_reload (self ) -> None :
@@ -115,7 +111,7 @@ async def async_reload(self) -> None:
115111 """
116112
117113 updated = await self ._client .trainings .async_get (self .id )
118- for name , value in updated .dict ().items ():
114+ for name , value in updated .model_dump ().items ():
119115 setattr (self , name , value )
120116
121117
0 commit comments