1
1
#!/usr/bin/env python
2
- # -*- coding: utf-8; -*-
3
2
4
3
# Copyright (c) 2022, 2024 Oracle and/or its affiliates.
5
4
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
7
6
import logging
8
- import time
9
7
from functools import wraps
10
8
from io import BytesIO
11
9
from typing import Callable , Dict , List , Optional
12
10
13
11
import oci .data_science
14
- from ads .common import utils
15
- from ads .common .object_storage_details import ObjectStorageDetails
16
- from ads .common .oci_datascience import OCIDataScienceMixin
17
- from ads .common .oci_mixin import OCIWorkRequestMixin
18
- from ads .common .oci_resource import SEARCH_TYPE , OCIResource
19
- from ads .common .utils import extract_region
20
- from ads .common .work_request import DataScienceWorkRequest
21
- from ads .model .deployment import ModelDeployment
22
12
from oci .data_science .models import (
23
13
ArtifactExportDetailsObjectStorage ,
24
14
ArtifactImportDetailsObjectStorage ,
25
15
CreateModelDetails ,
26
16
ExportModelArtifactDetails ,
27
17
ImportModelArtifactDetails ,
28
18
UpdateModelDetails ,
29
- WorkRequest ,
30
19
)
31
20
from oci .exceptions import ServiceError
32
21
22
+ from ads .common .object_storage_details import ObjectStorageDetails
23
+ from ads .common .oci_datascience import OCIDataScienceMixin
24
+ from ads .common .oci_mixin import OCIWorkRequestMixin
25
+ from ads .common .oci_resource import SEARCH_TYPE , OCIResource
26
+ from ads .common .utils import extract_region
27
+ from ads .common .work_request import DataScienceWorkRequest
28
+ from ads .model .deployment import ModelDeployment
29
+
33
30
logger = logging .getLogger (__name__ )
34
31
35
32
_REQUEST_INTERVAL_IN_SEC = 3
@@ -282,7 +279,7 @@ def get_artifact_info(self) -> Dict:
282
279
msg = "Model needs to be restored before the archived artifact content can be accessed."
283
280
)
284
281
def restore_archived_model_artifact (
285
- self , restore_model_for_hours_specified : Optional [int ] = None
282
+ self , restore_model_for_hours_specified : Optional [int ] = None
286
283
) -> None :
287
284
"""Restores the archived model artifact.
288
285
@@ -304,7 +301,8 @@ def restore_archived_model_artifact(
304
301
"""
305
302
return self .client .restore_archived_model_artifact (
306
303
model_id = self .id ,
307
- restore_model_for_hours_specified = restore_model_for_hours_specified ).headers ["opc-work-request-id" ]
304
+ restore_model_for_hours_specified = restore_model_for_hours_specified ,
305
+ ).headers ["opc-work-request-id" ]
308
306
309
307
@check_for_model_id (
310
308
msg = "Model needs to be saved to the Model Catalog before the artifact content can be read."
@@ -581,7 +579,7 @@ def from_id(cls, ocid: str) -> "OCIDataScienceModel":
581
579
raise ValueError ("Model OCID not provided." )
582
580
return super ().from_ocid (ocid )
583
581
584
- def is_model_by_reference (self ):
582
+ def _is_model_by_reference (self ):
585
583
"""Checks if model is created by reference
586
584
Returns
587
585
-------
0 commit comments