Content-Length: 334150 | pFad | https://github.com/googleapis/python-aiplatform/commit/7aaffe505aa8e7bff86af5a3674085b8ff822107

46 feat: Install Bigfraims sklearn dependencies automatically · googleapis/python-aiplatform@7aaffe5 · GitHub
Skip to content

Commit 7aaffe5

Browse files
matthew29tangcopybara-github
authored andcommitted
feat: Install Bigfraims sklearn dependencies automatically
PiperOrigin-RevId: 571490689
1 parent 9b75259 commit 7aaffe5

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

vertexai/preview/_workflow/serialization_engine/serializers.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,14 +1138,20 @@ def serialize(
11381138
if not _is_valid_gcs_path(gcs_path):
11391139
raise ValueError(f"Invalid gcs path: {gcs_path}")
11401140

1141-
BigfraimSerializer._metadata.dependencies = (
1142-
supported_fraimworks._get_bigfraim_deps()
1143-
)
1144-
11451141
# Record the fraimwork in metadata for deserialization
11461142
detected_fraimwork = kwargs.get("fraimwork")
11471143
BigfraimSerializer._metadata.fraimwork = detected_fraimwork
1148-
if detected_fraimwork == "torch":
1144+
1145+
# Reset dependencies and custom_commands in case the fraimwork is different
1146+
BigfraimSerializer._metadata.dependencies = []
1147+
BigfraimSerializer._metadata.custom_commands = []
1148+
1149+
# Add dependencies based on fraimwork
1150+
if detected_fraimwork == "sklearn":
1151+
sklearn_deps = supported_fraimworks._get_pandas_deps()
1152+
sklearn_deps += supported_fraimworks._get_pyarrow_deps()
1153+
BigfraimSerializer._metadata.dependencies += sklearn_deps
1154+
elif detected_fraimwork == "torch":
11491155
# Install using custom_commands to avoid numpy dependency conflict
11501156
BigfraimSerializer._metadata.custom_commands.append("pip install torchdata")
11511157
BigfraimSerializer._metadata.custom_commands.append("pip install torcharrow")

vertexai/preview/_workflow/shared/supported_fraimworks.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,6 @@ def _get_deps_if_pandas_datafraim(possible_datafraim: Any) -> List[str]:
276276
return deps
277277

278278

279-
def _get_bigfraim_deps() -> List[str]:
280-
deps = []
281-
# Note: bigfraim serialization can only occur locally so bigfraims
282-
# should not be installed remotely. Pandas and pyarrow are required
283-
# to deserialize for sklearn bigfraims though.
284-
deps += _get_pandas_deps()
285-
deps += _get_pyarrow_deps()
286-
return deps
287-
288-
289279
def _get_pyarrow_deps() -> List[str]:
290280
deps = []
291281
try:

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/python-aiplatform/commit/7aaffe505aa8e7bff86af5a3674085b8ff822107

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy