id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
166,112
import functools from typing import Callable, Dict, List import absl from flax import linen as nn from flax.metrics import tensorboard import jax from jax import numpy as jnp from jax.experimental import jax2tf import numpy as np import optax import tensorflow as tf import tensorflow_transform as tft from tfx import v1...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,113
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx import v1 as tfx The provided code snippet includes necessary dependencies for implementing the `_create_pipeline` function. Write a Python function `def _create_pipeline( pipeline_name: str, pipeline_root: str, ...
Implements the penguin pipeline with TFX.
166,114
from typing import List import keras_tuner as kt import tensorflow as tf import tensorflow_decision_forests as tfdf import tensorflow_transform as tft from tfx import v1 as tfx from tfx.examples.penguin import penguin_utils_base as base from tfx_bsl.public import tfxio def _get_hyperparameters() -> kt.HyperParameters: ...
Builds a Keras Tuner for the model. Args: fn_args: Holds args as name/value pairs. - working_dir: working dir for tuning. - train_files: List of file paths containing training tf.Example data. - eval_files: List of file paths containing eval tf.Example data. - train_steps: number of train steps. - eval_steps: number of...
166,115
from typing import List import keras_tuner as kt import tensorflow as tf import tensorflow_decision_forests as tfdf import tensorflow_transform as tft from tfx import v1 as tfx from tfx.examples.penguin import penguin_utils_base as base from tfx_bsl.public import tfxio def _get_hyperparameters() -> kt.HyperParameters: ...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,116
import datetime import multiprocessing import os import socket import sys from typing import List, Optional import absl from absl import flags import tensorflow_model_analysis as tfma from tfx import v1 as tfx from tfx.utils import proto_utils def RangeConfigGenerator(input_date: tfx.dsl.components.Parameter[str], ...
Implements the penguin pipeline with TFX. Args: pipeline_name: name of the TFX pipeline being created. pipeline_root: root directory of the pipeline. data_root: directory containing the penguin data. module_file: path to files used in Trainer and Transform components. accuracy_threshold: minimum accuracy to push the mo...
166,117
import os import sys from typing import Dict, List, Optional, Union from absl import flags from absl import logging import tensorflow_model_analysis as tfma from tfx import v1 as tfx _gcp_region = 'us-central1' _vertex_job_spec = { 'project': _project_id, 'worker_pool_specs': [{ 'machine_spec': ...
Implements the penguin pipeline with TFX and Kubeflow Pipeline. Args: pipeline_name: name of the TFX pipeline being created. pipeline_root: root directory of the pipeline. Should be a valid GCS path. data_root: uri of the penguin data. module_file: uri of the module file used in Trainer, Transform and Tuner. ai_platfor...
166,118
import absl import keras_tuner import tensorflow as tf from tensorflow import keras import tensorflow_transform as tft from tfx import v1 as tfx from tfx.examples.penguin import penguin_utils_base as base def _get_hyperparameters() -> keras_tuner.HyperParameters: """Returns hyperparameters for building Keras model.""...
Build the tuner using the KerasTuner API. Args: fn_args: Holds args as name/value pairs. - working_dir: working dir for tuning. - train_files: List of file paths containing training tf.Example data. - eval_files: List of file paths containing eval tf.Example data. - train_steps: number of train steps. - eval_steps: num...
166,119
import absl import keras_tuner import tensorflow as tf from tensorflow import keras import tensorflow_transform as tft from tfx import v1 as tfx from tfx.examples.penguin import penguin_utils_base as base def _get_hyperparameters() -> keras_tuner.HyperParameters: """Returns hyperparameters for building Keras model.""...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,120
import os from typing import Dict, List, Optional import absl import tensorflow_model_analysis as tfma from tfx import v1 as tfx The provided code snippet includes necessary dependencies for implementing the `_create_pipeline` function. Write a Python function `def _create_pipeline( pipeline_name: str, pipelin...
Implements the Penguin pipeline with TFX.
166,121
import os import pickle from typing import Tuple import absl import numpy as np from sklearn.neural_network import MLPClassifier from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from tfx.components.trainer.fn_args_utils import DataAccessor from tfx.components.trainer.fn_args_utils ...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,122
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx import v1 as tfx The provided code snippet includes necessary dependencies for implementing the `_create_pipeline` function. Write a Python function `def _create_pipeline( pipeline_name: str, pipeline_root: str, ...
Implements the Penguin pipeline with TFX.
166,123
import copy import os import pickle from typing import Dict, Iterable, List import apache_beam as beam import tensorflow as tf import tensorflow_model_analysis as tfma from tfx_bsl.tfxio import tensor_adapter def _custom_model_loader_fn(model_path: str): """Returns a function that loads a scikit-learn model.""" ret...
Returns a single custom EvalSharedModel.
166,124
import copy import os import pickle from typing import Dict, Iterable, List import apache_beam as beam import tensorflow as tf import tensorflow_model_analysis as tfma from tfx_bsl.tfxio import tensor_adapter def _make_sklearn_predict_extractor( eval_shared_model: tfma.EvalSharedModel,) -> tfma.extractors.Extractor...
Returns default extractors plus a custom prediction extractor.
166,125
import datetime import os from typing import List import tensorflow_model_analysis as tfma from tfx.components import CsvExampleGen from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import Stat...
Implements the chicago taxi pipeline with TFX.
166,126
from typing import List import absl from keras.callbacks import LambdaCallback import tensorflow as tf import tensorflow_transform as tft from tfx.components.trainer.executor import TrainerFnArgs from tfx.components.trainer.fn_args_utils import DataAccessor from tfx_bsl.tfxio import dataset_options _NUMERICAL_FEATURES...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,127
from typing import List import absl from keras.callbacks import LambdaCallback import tensorflow as tf import tensorflow_transform as tft from tfx.components.trainer.executor import TrainerFnArgs from tfx.components.trainer.fn_args_utils import DataAccessor from tfx_bsl.tfxio import dataset_options def export_serving_...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,128
import re from IPython.display import display_html import matplotlib.pyplot as plt import networkx as nx import pandas as pd from ml_metadata.proto import metadata_store_pb2 The provided code snippet includes necessary dependencies for implementing the `_is_output_event` function. Write a Python function `def _is_outp...
Checks if event is an Output event.
166,129
import re from IPython.display import display_html import matplotlib.pyplot as plt import networkx as nx import pandas as pd from ml_metadata.proto import metadata_store_pb2 The provided code snippet includes necessary dependencies for implementing the `_is_input_event` function. Write a Python function `def _is_input...
Checks if event is an Input event.
166,130
import re from IPython.display import display_html import matplotlib.pyplot as plt import networkx as nx import pandas as pd from ml_metadata.proto import metadata_store_pb2 The provided code snippet includes necessary dependencies for implementing the `_get_value_str` function. Write a Python function `def _get_value...
Returns a string representation of a `metadata_store_pb2.Value` object.
166,131
import os from typing import Dict, List from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import ModelValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen from tfx.components import Trainer from tfx.c...
Implements the chicago taxi pipeline with TFX and Kubeflow Pipelines.
166,132
from typing import List import tensorflow as tf from tensorflow import estimator as tf_estimator import tensorflow_model_analysis as tfma import tensorflow_transform as tft from tensorflow_transform.tf_metadata import schema_utils from tfx.components.trainer.fn_args_utils import DataAccessor from tfx_bsl.tfxio import d...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,133
from typing import List import tensorflow as tf from tensorflow import estimator as tf_estimator import tensorflow_model_analysis as tfma import tensorflow_transform as tft from tensorflow_transform.tf_metadata import schema_utils from tfx.components.trainer.fn_args_utils import DataAccessor from tfx_bsl.tfxio import d...
Build the estimator using the high level API. Args: trainer_fn_args: Holds args used to train the model as name/value pairs. schema: Holds the schema of the training examples. Returns: A dict of the following: - estimator: The estimator that will be used for training and eval. - train_spec: Spec for training. - eval_sp...
166,134
import tensorflow as tf import tensorflow_transform as tft from tfx.components.trainer.fn_args_utils import FnArgs from tfx.examples.mnist import mnist_utils_native_keras_base as base The provided code snippet includes necessary dependencies for implementing the `preprocessing_fn` function. Write a Python function `de...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,135
import tensorflow as tf import tensorflow_transform as tft from tfx.components.trainer.fn_args_utils import FnArgs from tfx.examples.mnist import mnist_utils_native_keras_base as base def _get_serve_tf_examples_fn(model, tf_transform_output): """Returns a function that parses a serialized tf.Example.""" model.tft_l...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,136
import os import tensorflow as tf import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.trainer.rewriting import converters from tfx.components.trainer.rewriting import rewriter from tfx.components.trainer.rewriting import rewriter_factory from tfx.examples.mnist import mnist_utils_native_ker...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,137
import os import tensorflow as tf import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.trainer.rewriting import converters from tfx.components.trainer.rewriting import rewriter from tfx.components.trainer.rewriting import rewriter_factory from tfx.examples.mnist import mnist_utils_native_ker...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,138
from typing import List import absl import tensorflow as tf import tensorflow_transform as tft from tfx.components.trainer.fn_args_utils import DataAccessor from tfx_bsl.tfxio import dataset_options IMAGE_KEY = 'image_floats' LABEL_KEY = 'image_class' def transformed_name(key): return key + '_xf' The provided code s...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,139
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import ImportExampleGen from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import Statistics...
Implements the handwritten digit classification example using TFX.
166,140
import itertools from typing import Dict, List, Optional, Union from struct2tensor import calculate from struct2tensor import calculate_options from struct2tensor import path from struct2tensor import prensor_util from struct2tensor.expression_impl import proto as proto_expr import tensorflow as tf from tfx_bsl.public ...
Parses a batch of ELWC records into RaggedTensors using struct2tensor. Args: records: A dictionary with a single item. The value of this single item is the serialized ELWC input. context_features: List of context-level features. example_features: List of example-level features. size_feature_name: A string, the name of ...
166,141
import tensorflow as tf import tensorflow_ranking as tfr import tensorflow_transform as tft from tfx.examples.ranking import features from tfx.examples.ranking import struct2tensor_parsing_utils from tfx_bsl.public import tfxio The provided code snippet includes necessary dependencies for implementing the `make_decode...
Creates a data decoder that that decodes ELWC records to tensors. A DataView (see "TfGraphDataViewProvider" component in the pipeline) will refer to this decoder. And any components that consumes the data with the DataView applied will use this decoder. Returns: A ELWC decoder.
166,142
import tensorflow as tf import tensorflow_ranking as tfr import tensorflow_transform as tft from tfx.examples.ranking import features from tfx.examples.ranking import struct2tensor_parsing_utils from tfx_bsl.public import tfxio The provided code snippet includes necessary dependencies for implementing the `preprocessi...
Transform preprocessing_fn.
166,143
import tensorflow as tf import tensorflow_ranking as tfr import tensorflow_transform as tft from tfx.examples.ranking import features from tfx.examples.ranking import struct2tensor_parsing_utils from tfx_bsl.public import tfxio def _input_fn(file_patterns, data_accessor, batch_size) -> tf.da...
TFX trainer entry point.
166,144
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx.components import Evaluator from tfx.components import ImportExampleGen from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen from tfx.components import Trainer from ...
Creates pipeline.
166,145
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx.components import CsvExampleGen from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen...
Implements the Bert classication on Cola dataset pipline with TFX.
166,146
from typing import List import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_hub as hub import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.transform import stats_options_util from tfx.examples.bert.utils.bert_models import build_and_compile_bert_classifier fr...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature Tensors.
166,147
from typing import List import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_hub as hub import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.transform import stats_options_util from tfx.examples.bert.utils.bert_models import build_and_compile_bert_classifier fr...
Update transform stats. This function is called by the Transform component before it computes pre-transform or post-transform statistics. It takes as input a stats_type, which indicates whether this call is intended for pre-transform or post-transform statistics. It also takes as argument the StatsOptions that are to b...
166,148
from typing import List import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_hub as hub import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.transform import stats_options_util from tfx.examples.bert.utils.bert_models import build_and_compile_bert_classifier fr...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,149
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx.components import CsvExampleGen from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen...
Implements the Bert classication on mrpc dataset pipline with TFX.
166,150
from typing import List import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_hub as hub import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.transform import stats_options_util from tfx.examples.bert.utils.bert_models import build_and_compile_bert_classifier fr...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature Tensors.
166,151
from typing import List import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_hub as hub import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.transform import stats_options_util from tfx.examples.bert.utils.bert_models import build_and_compile_bert_classifier fr...
Update transform stats. This function is called by the Transform component before it computes pre-transform or post-transform statistics. It takes as input a stats_type, which indicates whether this call is intended for pre-transform or post-transform statistics. It also takes as argument the StatsOptions that are to b...
166,152
from typing import List import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_hub as hub import tensorflow_transform as tft from tfx import v1 as tfx from tfx.components.transform import stats_options_util from tfx.examples.bert.utils.bert_models import build_and_compile_bert_classifier fr...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,153
import os import pandas as pd import tensorflow_datasets as tfds The provided code snippet includes necessary dependencies for implementing the `fetch_data` function. Write a Python function `def fetch_data()` to solve the following problem: This downloads the full dataset to $(pwd)/data/imdb.csv. Here is the functio...
This downloads the full dataset to $(pwd)/data/imdb.csv.
166,154
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx.components import CsvExampleGen from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen...
Implements the imdb sentiment analysis pipline with TFX.
166,155
from typing import List import absl import tensorflow as tf from tensorflow import keras import tensorflow_transform as tft from tfx.components.trainer.fn_args_utils import DataAccessor from tfx.components.trainer.fn_args_utils import FnArgs from tfx_bsl.tfxio import dataset_options _FEATURE_KEY = 'text' _LABEL_KEY = '...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,156
from typing import List import absl import tensorflow as tf from tensorflow import keras import tensorflow_transform as tft from tfx.components.trainer.fn_args_utils import DataAccessor from tfx.components.trainer.fn_args_utils import FnArgs from tfx_bsl.tfxio import dataset_options _EVAL_BATCH_SIZE = 5 _TRAIN_BATCH_SI...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs.
166,157
import os import absl from tfx.components import CsvExampleGen from tfx.components import StatisticsGen from tfx.examples.custom_components.hello_world.hello_component import component from tfx.orchestration import metadata from tfx.orchestration import pipeline from tfx.orchestration.beam.beam_dag_runner import BeamDa...
Implements the chicago taxi pipeline with TFX.
166,158
import os import absl from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import ModelValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen from tfx.components import Trainer from tfx.components import T...
Implements the chicago taxi pipeline with TFX.
166,159
import datetime from typing import Any, Dict, Iterable, Tuple import apache_beam as beam import prestodb import tensorflow as tf from tfx.components.example_gen import base_example_gen_executor from tfx.examples.custom_components.presto_example_gen.proto import presto_config_pb2 from tfx.proto import example_gen_pb2 fr...
Read from Presto and transform to TF examples. Args: pipeline: beam pipeline. exec_properties: A dict of execution properties. split_pattern: Split.pattern in Input config, a Presto sql string. Returns: PCollection of TF examples.
166,160
from tfx.dsl.component.experimental import container_component from tfx.dsl.component.experimental import placeholders from tfx.types import standard_artifacts downloader_component = container_component.create_container_component( name='DownloadFromHttp', outputs={ 'data': standard_artifacts.ExternalArt...
Creates tasks for the download_grep_print pipeline.
166,161
from typing import List import tensorflow as tf from tensorflow import estimator as tf_estimator import tensorflow_model_analysis as tfma import tensorflow_transform as tft from tensorflow_transform.tf_metadata import schema_utils from tfx.components.trainer.fn_args_utils import DataAccessor from tfx_bsl.tfxio import d...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,162
from typing import List import tensorflow as tf from tensorflow import estimator as tf_estimator import tensorflow_model_analysis as tfma import tensorflow_transform as tft from tensorflow_transform.tf_metadata import schema_utils from tfx.components.trainer.fn_args_utils import DataAccessor from tfx_bsl.tfxio import d...
Build the estimator using the high level API. Args: trainer_fn_args: Holds args used to train the model as name/value pairs. schema: Holds the schema of the training examples. Returns: A dict of the following: - estimator: The estimator that will be used for training and eval. - train_spec: Spec for training. - eval_sp...
166,163
import datetime import os from tfx.components import CsvExampleGen from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import ModelValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen from tfx.component...
Implements the chicago taxi pipeline with TFX.
166,164
import datetime import os from tfx.components import CsvExampleGen from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import ModelValidator from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import StatisticsGen from tfx.component...
Implements the chicago taxi pipeline with TFX.
166,165
import os from typing import List import absl import flatbuffers import tensorflow as tf import tensorflow_transform as tft from tfx.components.trainer.fn_args_utils import DataAccessor from tfx.components.trainer.fn_args_utils import FnArgs from tfx.components.trainer.rewriting import converters from tfx.components.tr...
tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. Returns: Map from string feature key to transformed feature operations.
166,166
import os from typing import List import absl import flatbuffers import tensorflow as tf import tensorflow_transform as tft from tfx.components.trainer.fn_args_utils import DataAccessor from tfx.components.trainer.fn_args_utils import FnArgs from tfx.components.trainer.rewriting import converters from tfx.components.tr...
Train the model based on given args. Args: fn_args: Holds args used to train the model as name/value pairs. Raises: ValueError: if invalid inputs.
166,167
import os from typing import List import absl import tensorflow_model_analysis as tfma from tfx.components import Evaluator from tfx.components import ExampleValidator from tfx.components import ImportExampleGen from tfx.components import Pusher from tfx.components import SchemaGen from tfx.components import Statistics...
Implements the CIFAR10 image classification pipeline using TFX.
166,168
import os def make_extra_packages_docker_image(): # Packages needed for tfx docker image. return [ # TODO(b/304892416): Migrate from KFP SDK v1 to v2. 'kfp>=1.8.14,<2', 'kfp-pipeline-spec>=0.1.10,<0.2', 'mmh>=2.2,<3', 'python-snappy>=0.5,<0.6', # Required for tfx/examples/pengui...
null
166,169
import os def make_extra_packages_test(): """Prepare extra packages needed for running unit tests.""" # Note: It is okay to pin packages to exact versions in this list to minimize # conflicts. return make_extra_packages_airflow() + make_extra_packages_kfp() + [ 'pytest>=5,<7', ] def make_extra_packages_...
null
166,170
import collections import shutil import tempfile import time from absl import logging import apache_beam as beam from apache_beam.utils import shared import tensorflow as tf import tensorflow_transform as tft from tensorflow_transform import graph_tools from tensorflow_transform import impl_helper import tensorflow_tra...
Regenerate intermediate outputs required for the benchmark.
166,171
import collections import shutil import tempfile import time from absl import logging import apache_beam as beam from apache_beam.utils import shared import tensorflow as tf import tensorflow_transform as tft from tensorflow_transform import graph_tools from tensorflow_transform import impl_helper import tensorflow_tra...
Returns a (batch_size, iterator for batched records) tuple for the dataset. Args: dataset: BenchmarkDataset object. force_tf_compat_v1: If False then Transform will use its native TF2 version, if True then Transform will use its TF1 version. max_num_examples: Maximum number of examples to read from the dataset. Returns...
166,172
import importlib from google.protobuf import text_format from tensorflow_metadata.proto.v0 import schema_pb2 The provided code snippet includes necessary dependencies for implementing the `get_dataset` function. Write a Python function `def get_dataset(name, base_dir=None)` to solve the following problem: Imports the ...
Imports the given dataset and returns an instance of it.
166,173
import itertools import math import os import shutil import tempfile from typing import Optional from absl import logging import apache_beam as beam import tensorflow_transform as tft from tfx import components from tfx.benchmarks import benchmark_dataset from tfx.components.example_gen.csv_example_gen import executor ...
null
166,174
import itertools import math import os import shutil import tempfile from typing import Optional from absl import logging import apache_beam as beam import tensorflow_transform as tft from tfx import components from tfx.benchmarks import benchmark_dataset from tfx.components.example_gen.csv_example_gen import executor ...
null
166,175
from typing import TypeVar from absl import flags from tfx.orchestration.portable import data_types from tfx.orchestration.python_execution_binary import python_execution_binary_utils as flag_utils _LEGACY_EXECUTION_INVOCATION = flags.DEFINE_string( 'tfx_execution_info_b64', None, 'url safe base64 encoded t...
null
166,176
from typing import Optional, Union from absl import logging from tfx.dsl.io import fileio from tfx.orchestration import metadata from tfx.orchestration.portable import data_types from tfx.orchestration.portable import python_driver_operator from tfx.proto.orchestration import driver_output_pb2 from tfx.proto.orchestrat...
Run Python executable.
166,177
import base64 from typing import Union from tfx.orchestration import metadata from tfx.orchestration.portable import data_types from tfx.proto.orchestration import executable_spec_pb2 from tfx.proto.orchestration import execution_invocation_pb2 from tfx.proto.orchestration import metadata_pb2 from tfx.utils import impo...
Import the class path from Python or Beam executor spec.
166,178
import base64 from typing import Union from tfx.orchestration import metadata from tfx.orchestration.portable import data_types from tfx.proto.orchestration import executable_spec_pb2 from tfx.proto.orchestration import execution_invocation_pb2 from tfx.proto.orchestration import metadata_pb2 from tfx.utils import impo...
De-serializes an MLMD connection config from base64 flag.
166,179
import base64 from typing import Union from tfx.orchestration import metadata from tfx.orchestration.portable import data_types from tfx.proto.orchestration import executable_spec_pb2 from tfx.proto.orchestration import execution_invocation_pb2 from tfx.proto.orchestration import metadata_pb2 from tfx.utils import impo...
De-serializes an executable spec from base64 flag.
166,180
import base64 from typing import Union from tfx.orchestration import metadata from tfx.orchestration.portable import data_types from tfx.proto.orchestration import executable_spec_pb2 from tfx.proto.orchestration import execution_invocation_pb2 from tfx.proto.orchestration import metadata_pb2 from tfx.utils import impo...
Serializes an MLMD connection config into a base64 flag of its wrapper.
166,181
import base64 from typing import Union from tfx.orchestration import metadata from tfx.orchestration.portable import data_types from tfx.proto.orchestration import executable_spec_pb2 from tfx.proto.orchestration import execution_invocation_pb2 from tfx.proto.orchestration import metadata_pb2 from tfx.utils import impo...
Serializes an executable spec into a base64 flag.
166,182
import base64 from typing import Union from tfx.orchestration import metadata from tfx.orchestration.portable import data_types from tfx.proto.orchestration import executable_spec_pb2 from tfx.proto.orchestration import execution_invocation_pb2 from tfx.proto.orchestration import metadata_pb2 from tfx.utils import impo...
Serializes the ExecutionInfo class from a base64 flag.
166,183
import itertools from typing import Any, Dict, List, Optional, Tuple, cast from absl import logging from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import components from tfx.components.evaluator import constants from tfx.dsl.compiler import compiler_utils as tfx_compiler_utils from tfx.dsl.com...
Resolves placeholders in the command line of a container. Args: container_spec: Container structure to resolve exec_properties: The map of component's execution properties Returns: Resolved command line. Raises: TypeError: On unsupported type of command-line arguments, or when the resolved argument is not a string.
166,184
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Converts RuntimeParameters to mapping from names to proto messages.
166,185
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Extracts the artifact type info into ComponentInputsSpec.ParameterSpec.
166,186
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Builds artifact type spec for an input channel.
166,187
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Builds parameter type spec for an output channel.
166,188
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Builds artifact type spec for an output channel.
166,189
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Packs artifact properties and custom properties into a Struct proto.
166,190
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Gets the schema title from the artifact python class.
166,191
import itertools import json import os import re from typing import Any, Dict, List, Mapping, Optional, Type, Union from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx import types from tfx.dsl.io import fileio from tfx.orchestration import data_types from tfx.orchestration.kubeflow.v2 import param...
Encodes a Predicate into a CEL string expression. The CEL specification is at: https://github.com/google/cel-spec/blob/master/doc/langdef.md Args: expression: A PlaceholderExpression proto descrbing a Predicate. Returns: A CEL expression in string format.
166,192
import argparse import os from typing import List, Tuple from absl import app from absl import logging from absl.flags import argparse_flags from kfp.pipeline_spec import pipeline_spec_pb2 from tfx.components.evaluator import executor as evaluator_executor from tfx.dsl.components.base import base_beam_executor from tfx...
Selects a particular executor and run it based on name. Args: args: --executor_class_path: The import path of the executor class. --json_serialized_invocation_args: Full JSON-serialized parameters for this execution. beam_args: Optional parameter that maps to the optional_pipeline_args parameter in the pipeline, which ...
166,193
import argparse import os from typing import List, Tuple from absl import app from absl import logging from absl.flags import argparse_flags from kfp.pipeline_spec import pipeline_spec_pb2 from tfx.components.evaluator import executor as evaluator_executor from tfx.dsl.components.base import base_beam_executor from tfx...
Parses command line arguments. Args: argv: Unparsed arguments for run_executor.py. Known argument names include --executor_class_path: Python class of executor in format of <module>.<class>. --json_serialized_invocation_args: Full JSON-serialized parameters for this execution. The remaining part of the arguments will b...
166,194
import random import re import string import typing from typing import Any, Dict, List, Mapping, Optional, Union from absl import logging from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx.dsl.components.base import base_node from tfx.dsl.placeholder import placeholder from tfx.orchestration impor...
Checks the user-provided pipeline name.
166,195
import random import re import string import typing from typing import Any, Dict, List, Mapping, Optional, Union from absl import logging from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx.dsl.components.base import base_node from tfx.dsl.placeholder import placeholder from tfx.orchestration impor...
null
166,196
import random import re import string import typing from typing import Any, Dict, List, Mapping, Optional, Union from absl import logging from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx.dsl.components.base import base_node from tfx.dsl.placeholder import placeholder from tfx.orchestration impor...
Gets component image path given component_id.
166,197
import random import re import string import typing from typing import Any, Dict, List, Mapping, Optional, Union from absl import logging from kfp.pipeline_spec import pipeline_spec_pb2 as pipeline_pb2 from tfx.dsl.components.base import base_node from tfx.dsl.placeholder import placeholder from tfx.orchestration impor...
null
166,198
import argparse import os from typing import List from absl import app from absl import logging from absl.flags import argparse_flags from kfp.pipeline_spec import pipeline_spec_pb2 from tfx.components.example_gen import driver from tfx.components.example_gen import input_processor from tfx.components.example_gen impor...
Runs the driver, writing its output as a ExecutorOutput proto. The main goal of this driver is to calculate the span and fingerprint of input data, allowing for the executor invocation to be skipped if the ExampleGen component has been previously run on the same data with the same configuration. This span and fingerpri...
166,199
import argparse import os from typing import List from absl import app from absl import logging from absl.flags import argparse_flags from kfp.pipeline_spec import pipeline_spec_pb2 from tfx.components.example_gen import driver from tfx.components.example_gen import input_processor from tfx.components.example_gen impor...
Command lines flag parsing.
166,200
import datetime import json import os from typing import Any, Dict, List, Optional, Union, MutableMapping from absl import logging from kfp.pipeline_spec import pipeline_spec_pb2 from tfx import version from tfx.dsl.components.base import base_component from tfx.dsl.components.base import base_node from tfx.dsl.io impo...
Gets the current timestamp.
166,201
from typing import Any, Dict, List, Optional from tfx.dsl.component.experimental import component_utils from tfx.dsl.component.experimental import placeholders from tfx.dsl.components.base import base_component from tfx.dsl.components.base import executor_spec from tfx.orchestration.kubeflow.v2.components.experimental ...
Creates a pipeline step that launches a AIP training job. The generated TFX component will have a component spec specified dynamically, through inputs/outputs/parameters in the following format: - inputs: A mapping from input name to the upstream channel connected. The artifact type of the channel will be automatically...
166,202
import datetime import time from absl import logging from google.cloud.aiplatform import pipeline_jobs from google.cloud.aiplatform_v1.types import pipeline_state _PIPELINE_COMPLETE_STATES = frozenset([ pipeline_state.PipelineState.PIPELINE_STATE_SUCCEEDED, pipeline_state.PipelineState.PIPELINE_STATE_FAILED, ...
Checks the status of the job. NOTE: aiplatform.init() should be already called. Args: job_id: The relative ID of the pipeline job. timeout: Timeout duration for the job execution. polling_interval_secs: Interval to check the job status. Raises: RuntimeError: On (1) unexpected response from service; or (2) on unexpected...
166,203
from tfx.dsl.components.base import base_node from tfx.orchestration.kubeflow.decorators import FinalStatusStr class FinalStatusStr(str): """FinalStatusStr: is the type for parameter receiving PipelineTaskFinalStatus. Vertex AI backend passes in jsonlized string of kfp.pipeline_spec.pipeline_spec_pb2.PipelineTa...
Replaces TFX placeholders in execution properties with KFP placeholders.
166,204
from tfx.dsl.components.base import base_node from tfx.orchestration.kubeflow.decorators import FinalStatusStr The provided code snippet includes necessary dependencies for implementing the `fix_brackets` function. Write a Python function `def fix_brackets(placeholder: str) -> str` to solve the following problem: Fix ...
Fix the imbalanced brackets in placeholder. When ptype is not null, regex matching might grab a placeholder with } missing. This function fix the missing bracket. Args: placeholder: string placeholder of RuntimeParameter Returns: Placeholder with re-balanced brackets. Raises: RuntimeError: if left brackets are less tha...
166,205
from typing import Dict, List, Set from absl import logging from kfp import dsl from kubernetes import client as k8s_client from tfx.dsl.components.base import base_node as tfx_base_node from tfx.orchestration import data_types from tfx.orchestration import pipeline as tfx_pipeline from tfx.orchestration.kubeflow.proto...
Encode a runtime parameter into a placeholder for value substitution.
166,206
from typing import Dict, List, Set from absl import logging from kfp import dsl from kubernetes import client as k8s_client from tfx.dsl.components.base import base_node as tfx_base_node from tfx.orchestration import data_types from tfx.orchestration import pipeline as tfx_pipeline from tfx.orchestration.kubeflow.proto...
Replaces the RuntimeParameter placeholders with kfp.dsl.PipelineParam.
166,207
import types from typing import Any, Callable from tfx.dsl.component.experimental.decorators import component def component(func: types.FunctionType, /) -> BaseFunctionalComponentFactory: ... def component( *, component_annotation: Optional[ type[system_executions.SystemExecution] ] = None, ...
Creates an exit handler from a typehint-annotated Python function. This decorator creates an exit handler wrapping the component typehint annotation - typehint annotations specified for the arguments and return value for a Python function. Exit handler is to annotate the component for post actions of a pipeline, only s...
166,208
import collections import copy import os from typing import Any, Callable, Dict, List, Optional, Type, cast, MutableMapping from absl import logging from kfp import compiler from kfp import dsl from kfp import gcp from kubernetes import client as k8s_client from tfx import version from tfx.dsl.compiler import compiler ...
Mounts all key-value pairs found in the named Kubernetes Secret. All key-value pairs in the Secret are mounted as environment variables. Args: secret_name: The name of the Secret resource. Returns: An OpFunc for mounting the Secret.
166,209
import collections import copy import os from typing import Any, Callable, Dict, List, Optional, Type, cast, MutableMapping from absl import logging from kfp import compiler from kfp import dsl from kfp import gcp from kubernetes import client as k8s_client from tfx import version from tfx.dsl.compiler import compiler ...
Returns a default list of pipeline operator functions. Args: use_gcp_sa: If true, mount a GCP service account secret to each pod, with the name _KUBEFLOW_GCP_SECRET_NAME. Returns: A list of functions with type OpFunc.
166,210
import collections import copy import os from typing import Any, Callable, Dict, List, Optional, Type, cast, MutableMapping from absl import logging from kfp import compiler from kfp import dsl from kfp import gcp from kubernetes import client as k8s_client from tfx import version from tfx.dsl.compiler import compiler ...
Returns the default metadata connection config for Kubeflow. Returns: A config proto that will be serialized as JSON and passed to the running container so the TFX component driver is able to communicate with MLMD in a Kubeflow cluster.
166,211
import collections import copy import os from typing import Any, Callable, Dict, List, Optional, Type, cast, MutableMapping from absl import logging from kfp import compiler from kfp import dsl from kfp import gcp from kubernetes import client as k8s_client from tfx import version from tfx.dsl.compiler import compiler ...
Returns the default pod label dict for Kubeflow.