From 4029857c75c11cac8a55278ea71f6e926e3029b3 Mon Sep 17 00:00:00 2001 From: Pratishtha Abrol Date: Wed, 16 Jun 2021 13:22:19 +0530 Subject: [PATCH 1/3] defining input and output basics --- .../__pycache__/component.cpython-38.pyc | Bin 0 -> 2783 bytes component/__pycache__/executor.cpython-38.pyc | Bin 0 -> 3404 bytes component/component.py | 63 ++++++++++-------- component/component_test.py | 42 ++++++------ component/executor.py | 57 ++++++++++------ 5 files changed, 93 insertions(+), 69 deletions(-) create mode 100644 component/__pycache__/component.cpython-38.pyc create mode 100644 component/__pycache__/executor.cpython-38.pyc diff --git a/component/__pycache__/component.cpython-38.pyc b/component/__pycache__/component.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15f6a6b824dac08929b1de84d8a31ac518eed318 GIT binary patch literal 2783 zcma)8OK%)S5T4i0&dxq;Z=5)hkZ6z)EDGxz2n(T@#U!BMSXo=3xeVj!-raHLmF^y} zE$5U-IR)_pa!783f5KmwD<}Q}B0yEo?5^_=uvV99s;jHJUSIj3+jTYg^?&*GyPsAx z?Kk{5|FhuZ8Z7ZM5UP0^)u|EdiQyTE>6wY;SvtzhxRKbNt#~VLCXVMQz5#s8YboB2 z-K6cc72gED<8>78#NDLl^%UO%e#Ki+yc@43Yu=jT+i~CPU)N}db{}Z8%j}~I_f2md zBt5zUk`?A0T?EM`+8%3z)nKM;+Rky1HVIgFekT6T~ zEM=)2y6*lg60gXKh``7R;Vhtn$jPv_D#(Px`6$f`NrIG;JP?9`#*AmhbVdT6GMI1WK%a`y}Hegu8LeefiB|@#wi1 zB#1Mx@k1nMB$G1+hhOp&9Ek(TD0og8D8@0#Qt)s7BsWMGm!n%sBh4f^WJDBso^d>U zc%p(RS&$6f-=Q?LfmvENBOy!YRxYC~4dT+;XUB4&mkoK6GXYHRFc8dNgd8MYcFe*; zX51G!3sDfxf;45ZU&tuNGkpk5N&`-PjL#$pB}!LEmD*mwgM>-OQFBMxg1gU4-6N5u zm9^avAA0`RfRAgi#8*I==IK!32Gu>28q8u1YEtWw5$T@InowUY+IXZZ&P9&ej}5O) zn@b63cBljO*DCwtaK@5gRB%XLmX5)@(~m~;G~p+~)Q+m`U_n*~KvJC`3*}+iW5;1! zPzFJYBPsR=MrmP8ODC&i{Y>Z3y&7z|5HAUNh(b|zRCW47J*Dhc^;m!I4!Wh|`zeIa z_ekKN5#maxqn+&(?s{G5q9GRrr!oTa|V3Ldh} zDO7WDxLLWesGiN&aKrqBcfshpu*5nLN4IQ4bN{rOuI~P2H-P_JX}nSjHfZBd+yHXE z6qw~TnEgZ*z*F6GsmsB65{fiAC&z9)*O~8=$>AFnJ#w z;unzgfP{$X^B+2m%Y-HNfSj3BzvJ*rQ|+E9wI_h}Pjy|B#*rzlBj|@m`aMh9XZo2T zn@^lG^QnGjL62DX8nPwbGwr@{)IMuqcOYs*0PNsLK;luBLg5r4AZ1Cm1;nZRxF}aK#9_@59h9483sux4=MD-L=wDt4mnYRIuLgsf8S0=K=PKR& yDqh`PG(HBbifs2YxN#v@4lL)yGPR}iNj0lJ#gQj4GnTt-~R_uuNlDr literal 0 HcmV?d00001 diff --git a/component/__pycache__/executor.cpython-38.pyc b/component/__pycache__/executor.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..474a1949369446c2e91c9726695274f73664cfda GIT binary patch literal 3404 zcmb_fOK;rB5hgjD7iaXa{0f zx|?fB7+ux|;v56)F$XEPMSe;C0x>+HTWKqEM{d?0wX@EslXXX3 zoA}(cm-R<|L$^~e8;k~q?xe$PWwc`GZn~PSjn)j^OV_h&qidl1qm2)(*oz0Rt$4r( zN7rAqMmJ(--`X68yS8QRo`hMEawf(sWFPS~73^~%)0iDR{w<42rA5Xfkrg86x%NHp zV4A4^7-uShkW*HKN^!+_EmJW)m7<(XeP&i+VaCH;GcB0n@=MM_<%R4;lE<{Y(xKEz zK4FDOz%&=a#zL}4^3Y7ZtB_h~)Tqe9R6xedL{FK}Q;x;&7{Me@L(OBD6>~7ADHA!A zzfv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OO8Hl^*WmL8wf+usJ|$13#~FjGEVOJ$e% zyk<5LlI~ Date: Wed, 16 Jun 2021 13:38:14 +0530 Subject: [PATCH 2/3] removing references to Hello-World Boilerplate --- component/component.py | 12 ++---------- component/component_test.py | 3 +-- component/executor.py | 10 ++-------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/component/component.py b/component/component.py index 7642809..2a2f0cc 100644 --- a/component/component.py +++ b/component/component.py @@ -12,14 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Example of a Hello World TFX custom component. - -This custom component simply reads tf.Examples from input and passes through as -output. This is meant to serve as a kind of starting point example for creating -custom components. - -This component along with other custom component related code will only serve as -an example and will not be supported by TFX team. +"""TFX Schema Curation Custom Component """ from typing import List, Optional, Text @@ -27,7 +20,6 @@ from tfx import types from tfx.dsl.components.base import base_component from tfx.dsl.components.base import executor_spec -# from tfx.examples.custom_components.hello_world.hello_component import executor from tfx.types import channel_utils from tfx.types import standard_artifacts from tfx.types.component_spec import ChannelParameter @@ -37,7 +29,7 @@ import executor class SchemaCurationSpec(types.ComponentSpec): - """ComponentSpec for Custom TFX Schema Curation Component.""" + """ComponentSpec for TFX Schema Curation Custom Component.""" PARAMETERS = { # These are parameters that will be passed in the call to diff --git a/component/component_test.py b/component/component_test.py index 2ad3dd0..7524604 100644 --- a/component/component_test.py +++ b/component/component_test.py @@ -12,13 +12,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for SchemaCuration Component.""" +"""Tests for TFX Schema Curation Custom Component.""" import json import tensorflow as tf -# from tfx.examples.custom_components.hello_world.hello_component import component from tfx.types import artifact from tfx.types import channel_utils from tfx.types import standard_artifacts diff --git a/component/executor.py b/component/executor.py index e0590c2..7d14067 100644 --- a/component/executor.py +++ b/component/executor.py @@ -12,13 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Example of a Hello World TFX custom component. - -This custom component simply passes examples through. This is meant to serve as -a kind of starting point example for creating custom components. - -This component along with other custom component related code will only serve as -an example and will not be supported by TFX team. +"""Executor code for TFX Schema Curation Custom Component """ import json @@ -35,7 +29,7 @@ _DEFAULT_FILE_NAME = 'schema.pbtxt' class Executor(base_executor.BaseExecutor): - """Executor for HelloComponent.""" + """Executor for TFX Schema Curation Custom Component.""" def Do(self, input_dict: Dict[Text, List[types.Artifact]], output_dict: Dict[Text, List[types.Artifact]], From 1108e43241ff0af85a507352e577c5b95e8b2554 Mon Sep 17 00:00:00 2001 From: Pratishtha Abrol Date: Thu, 17 Jun 2021 16:33:34 +0530 Subject: [PATCH 3/3] module file parameters added to component spec class --- component/component.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/component/component.py b/component/component.py index 2a2f0cc..eb0073a 100644 --- a/component/component.py +++ b/component/component.py @@ -32,9 +32,9 @@ class SchemaCurationSpec(types.ComponentSpec): """ComponentSpec for TFX Schema Curation Custom Component.""" PARAMETERS = { - # These are parameters that will be passed in the call to - # create an instance of this component. - # 'name': ExecutionParameter(type=Text), + 'module_file': ExecutionParameter(type=str, optional=True), + 'module_path': ExecutionParameter(type=str, optional=True), + 'preprocessing_fn': ExecutionParameter(type=str, optional=True), 'exclude_splits': ExecutionParameter(type=str, optional=True), } INPUTS = { @@ -49,6 +49,12 @@ class SchemaCurationSpec(types.ComponentSpec): class SchemaCuration(base_component.BaseComponent): """Custom TFX Schema Curation Component. + The SchemaCuration component is used to apply user code to a chema generated by SchemaGen + in order to curate the schema based on domain knowledge. + + Component `outputs` contains: + - `output_schema`: Channel of type `standard_artifact.Schema` + Current progress : - Accepts schema, outputs the same schema """