File tree

5 files changed

+124
-10
lines changed

5 files changed

+124
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,49 @@
1515
# limitations under the License.
1616

1717
from google.cloud.aiplatform.helpers import _decorators
18-
from google.cloud.aiplatform.v1beta1.schema import predict
19-
from google.cloud.aiplatform.v1beta1.schema import trainingjob
18+
from google.cloud.aiplatform.v1.schema import predict
19+
from google.cloud.aiplatform.v1.schema import trainingjob
20+
from google.cloud.aiplatform.v1beta1.schema import predict as predict_v1beta1
21+
from google.cloud.aiplatform.v1beta1.schema import predict as trainingjob_v1beta1
22+
23+
# import the v1 submodules for enhancement
24+
from google.cloud.aiplatform.v1.schema.predict.instance_v1 import types as instance
25+
from google.cloud.aiplatform.v1.schema.predict.params_v1 import types as params
26+
from google.cloud.aiplatform.v1.schema.predict.prediction_v1 import types as prediction
27+
from google.cloud.aiplatform.v1.schema.trainingjob.definition_v1 import (
28+
types as definition,
29+
)
30+
31+
# import the v1beta1 submodules for enhancement
2032
from google.cloud.aiplatform.v1beta1.schema.predict.instance_v1beta1 import (
21-
types as instance,
33+
types as instance_v1beta1,
2234
)
2335
from google.cloud.aiplatform.v1beta1.schema.predict.params_v1beta1 import (
24-
types as params,
36+
types as params_v1beta1,
2537
)
2638
from google.cloud.aiplatform.v1beta1.schema.predict.prediction_v1beta1 import (
27-
types as prediction,
39+
types as prediction_v1beta1,
2840
)
2941
from google.cloud.aiplatform.v1beta1.schema.trainingjob.definition_v1beta1 import (
30-
types as definition,
42+
types as definition_v1beta1,
3143
)
3244

3345
__all__ = (
3446
"predict",
3547
"trainingjob",
48+
"predict_v1beta1",
49+
"trainingjob_v1beta1",
3650
)
3751

3852
enhanced_types_packages = [
3953
instance,
4054
params,
4155
prediction,
4256
definition,
57+
instance_v1beta1,
58+
params_v1beta1,
59+
prediction_v1beta1,
60+
definition_v1beta1,
4361
]
4462

4563
for pkg in enhanced_types_packages:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2021 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.cloud.aiplatform.v1.schema import predict
19+
from google.cloud.aiplatform.v1.schema import trainingjob
20+
21+
22+
__all__ = (
23+
"predict",
24+
"trainingjob",
25+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.cloud.aiplatform.v1.schema.predict import instance
19+
from google.cloud.aiplatform.v1.schema.predict import params
20+
from google.cloud.aiplatform.v1.schema.predict import prediction
21+
22+
__all__ = (
23+
"instance",
24+
"params",
25+
"prediction",
26+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2021 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.cloud.aiplatform.v1.schema.trainingjob import definition
19+
20+
__all__ = ("definition",)
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
# limitations under the License.
1414
from __future__ import absolute_import
1515

16-
from google.cloud.aiplatform.v1beta1.schema.trainingjob import definition
16+
from google.cloud.aiplatform.v1.schema.trainingjob import definition
17+
from google.cloud.aiplatform.v1beta1.schema.trainingjob import (
18+
definition as definition_v1beta1,
19+
)
1720

1821
ModelType = definition.AutoMlImageClassificationInputs().ModelType
1922
test_training_input = definition.AutoMlImageClassificationInputs(
@@ -23,14 +26,36 @@
2326
disable_early_stopping=False,
2427
)
2528

29+
ModelType_v1beta1 = definition_v1beta1.AutoMlImageClassificationInputs().ModelType
30+
test_training_input_v1beta1 = definition.AutoMlImageClassificationInputs(
31+
multi_label=True,
32+
model_type=ModelType_v1beta1.CLOUD,
33+
budget_milli_node_hours=8000,
34+
disable_early_stopping=False,
35+
)
36+
2637

27-
def test_exposes_to_value_method():
38+
# Test the v1 enhanced types.
39+
def test_exposes_to_value_method_v1():
2840
assert hasattr(test_training_input, "to_value")
2941

3042

31-
def test_exposes_from_value_method():
43+
def test_exposes_from_value_method_v1():
3244
assert hasattr(test_training_input, "from_value")
3345

3446

35-
def test_exposes_from_map_method():
47+
def test_exposes_from_map_method_v1():
3648
assert hasattr(test_training_input, "from_map")
49+
50+
51+
# Test the v1beta1 enhanced types.
52+
def test_exposes_to_value_method_v1beta1():
53+
assert hasattr(test_training_input_v1beta1, "to_value")
54+
55+
56+
def test_exposes_from_value_method_v1beta1():
57+
assert hasattr(test_training_input_v1beta1, "from_value")
58+
59+
60+
def test_exposes_from_map_method_v1beta1():
61+
assert hasattr(test_training_input_v1beta1, "from_map")

0 commit comments

Comments
 (0)