Skip to content

Commit 70d8f7d

Browse files
authored
Revert "huggingface model handler for yaml - retry (#38451)" (#38601)
This reverts commit 65e8b65.
1 parent 8f6e271 commit 70d8f7d

7 files changed

Lines changed: 5 additions & 131 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"comment": "Modify this file in a trivial way to cause this test suite to run",
3-
"revision": 3
3+
"revision": 2
44
}

.github/workflows/beam_PostCommit_Yaml_Xlang_Direct.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
- name: run PostCommit Yaml Xlang Direct script
8181
uses: ./.github/actions/gradle-command-self-hosted-action
8282
with:
83-
gradle-command: :sdks:python:postCommitYamlIntegrationTests -PyamlTestSet=${{ matrix.test_set }}
83+
gradle-command: :sdks:python:postCommitYamlIntegrationTests -PyamlTestSet=${{ matrix.test_set }} -PbeamPythonExtra=ml_test,yaml
8484
- name: Archive Python Test Results
8585
uses: actions/upload-artifact@v7
8686
if: failure()

.github/workflows/beam_PreCommit_Yaml_Xlang_Direct.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
- name: run PreCommit Yaml Xlang Direct script
9292
uses: ./.github/actions/gradle-command-self-hosted-action
9393
with:
94-
gradle-command: :sdks:python:yamlIntegrationTests
94+
gradle-command: :sdks:python:yamlIntegrationTests -PbeamPythonExtra=ml_test,yaml
9595
- name: Archive Python Test Results
9696
uses: actions/upload-artifact@v7
9797
if: failure()

sdks/python/apache_beam/yaml/tests/runinference_vertexai.yaml renamed to sdks/python/apache_beam/yaml/tests/runinference.yaml

File renamed without changes.

sdks/python/apache_beam/yaml/tests/runinference_huggingface.yaml

Lines changed: 0 additions & 62 deletions
This file was deleted.

sdks/python/apache_beam/yaml/yaml_ml.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -282,55 +282,6 @@ def inference_output_type(self):
282282
('model_id', Optional[str])])
283283

284284

285-
@ModelHandlerProvider.register_handler_type('HuggingFacePipeline')
286-
class HuggingFacePipelineProvider(ModelHandlerProvider):
287-
def __init__(
288-
self,
289-
task: Optional[str] = None,
290-
model: Optional[str] = None,
291-
preprocess: Optional[dict[str, str]] = None,
292-
postprocess: Optional[dict[str, str]] = None,
293-
device: Optional[Any] = None,
294-
inference_fn: Optional[dict[str, str]] = None,
295-
load_pipeline_args: Optional[dict[str, Any]] = None,
296-
**kwargs):
297-
try:
298-
from apache_beam.ml.inference.huggingface_inference import HuggingFacePipelineModelHandler
299-
except ImportError:
300-
raise ValueError(
301-
'Unable to import HuggingFacePipelineModelHandler. Please '
302-
'install transformers dependencies.')
303-
304-
kwargs = {k: v for k, v in kwargs.items() if not k.startswith('_')}
305-
306-
inference_fn_obj = self.parse_processing_transform(
307-
inference_fn, 'inference_fn') if inference_fn else None
308-
309-
handler_kwargs = {}
310-
if inference_fn_obj:
311-
handler_kwargs['inference_fn'] = inference_fn_obj
312-
313-
_handler = HuggingFacePipelineModelHandler(
314-
task=task,
315-
model=model,
316-
device=device,
317-
load_pipeline_args=load_pipeline_args,
318-
**handler_kwargs,
319-
**kwargs)
320-
321-
super().__init__(_handler, preprocess, postprocess)
322-
323-
@staticmethod
324-
def validate(config):
325-
if not config.get('task') and not config.get('model'):
326-
raise ValueError(
327-
"HuggingFacePipeline requires either 'task' or "
328-
"'model' to be specified.")
329-
330-
def inference_output_type(self):
331-
return Any
332-
333-
334285
@beam.ptransform.ptransform_fn
335286
def run_inference(
336287
pcoll,

sdks/python/build.gradle

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,10 @@ tasks.register("generateYamlDocs") {
124124
outputs.file "${buildDir}/yaml-examples.html"
125125
}
126126

127-
tasks.register("installYamlIntegrationTestDeps") {
128-
dependsOn installGcpTest
129-
doLast {
130-
exec {
131-
executable 'sh'
132-
args '-c', ". ${envdir}/bin/activate && " +
133-
"py_ver=\$(python -c 'import sys; print(f\"{sys.version_info.major}{sys.version_info.minor}\")') && " +
134-
"ml_extra=\"ml_test\" && " +
135-
"if [ \"\$py_ver\" -ge 313 ]; then ml_extra=\"p\${py_ver}_ml_test\"; fi && " +
136-
"echo \"Installing dependencies...\" && " +
137-
"pip install --pre --retries 10 ${buildDir}/apache-beam.tar.gz[\$ml_extra,yaml,transformers]"
138-
}
139-
}
140-
}
141-
142127
tasks.register("yamlIntegrationTests") {
143128
description "Runs precommit integration tests for yaml pipelines."
144129

145-
dependsOn installYamlIntegrationTestDeps
130+
dependsOn installGcpTest
146131
// Need to build all expansion services referenced in apache_beam/yaml/*.*
147132
// grep -oh 'sdk.*Jar' sdks/python/apache_beam/yaml/*.yaml | sort | uniq
148133
dependsOn ":sdks:java:extensions:schemaio-expansion-service:shadowJar"
@@ -161,7 +146,7 @@ tasks.register("yamlIntegrationTests") {
161146
tasks.register("postCommitYamlIntegrationTests") {
162147
description "Runs postcommit integration tests for yaml pipelines - parameterized by yamlTestSet."
163148

164-
dependsOn installYamlIntegrationTestDeps
149+
dependsOn installGcpTest
165150
// Need to build all expansion services referenced in apache_beam/yaml/*.*
166151
// grep -oh 'sdk.*Jar' sdks/python/apache_beam/yaml/*.yaml | sort | uniq
167152
dependsOn ":sdks:java:extensions:schemaio-expansion-service:shadowJar"

0 commit comments

Comments
 (0)