internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: tensorflow/tfx

Issue:
base_component.BaseComponent.__str__ method raising KeyError
I got a `KeyError` when calling this method: `base_component.BaseComponent.__str__`

Here is the code to reproduce:

```python
import os
from tfx.utils.dsl_utils import csv_input
from tfx.components.example_gen.csv_example_gen.component import CsvExampleGen

_taxi_root = os.path.join(os.environ['HOME'], 'taxi')
_data_root = os.path.join(_taxi_root, 'data/simple')
examples = csv_input(_data_root)
example_gen = CsvExampleGen(input_base=examples)
print(example_gen)
```

The error trace is:

```
/Users/alelevier/Documents/github/tfx/tfx/components/base/base_component.pyc in __str__(self)
     89         input_dict=self.input_dict,
     90         outputs=self.outputs,
---> 91         exec_properties=self.exec_properties)
     92 
     93   def __repr__(self):

KeyError: '\n  component_name'
```

I looked at the method, it needs use double `{{` and `}}` so change from:

```
  def __str__(self):
    return """
{
  component_name: {component_name},
  unique_name: {unique_name},
  driver: {driver},
  executor: {executor},
  input_dict: {input_dict},
  outputs: {outputs},
  exec_properties: {exec_properties}
}
    """.format(  # pylint: disable=missing-format-argument-key
        component_name=self.component_name,
        unique_name=self.unique_name,
        driver=self.driver,
        executor=self.executor,
        input_dict=self.input_dict,
        outputs=self.outputs,
        exec_properties=self.exec_properties)
```

To:

```
  def __str__(self):
    return """
{{
  component_name: {component_name},
  unique_name: {unique_name},
  driver: {driver},
  executor: {executor},
  input_dict: {input_dict},
  outputs: {outputs},
  exec_properties: {exec_properties}
}}
    """.format(  # pylint: disable=missing-format-argument-key
        component_name=self.component_name,
        unique_name=self.unique_name,
        driver=self.driver,
        executor=self.executor,
        input_dict=self.input_dict,
        outputs=self.outputs,
        exec_properties=self.exec_properties)
```


Discussion:

Resolving patch:
diff --git a/tfx/components/base/base_component.py b/tfx/components/base/base_component.py
--- a/tfx/components/base/base_component.py
+++ b/tfx/components/base/base_component.py
@@ -72,7 +72,7 @@ def __init__(self,
 
   def __str__(self):
     return """
-{
+{{
   component_name: {component_name},
   unique_name: {unique_name},
   driver: {driver},
@@ -80,7 +80,7 @@ def __str__(self):
   input_dict: {input_dict},
   outputs: {outputs},
   exec_properties: {exec_properties}
-}
+}}
     """.format(  # pylint: disable=missing-format-argument-key
         component_name=self.component_name,
         unique_name=self.unique_name,


Test patch:
Repository: tensorflow/tfx

Issue:
ImportExampleGen on Kubeflow not working
After building tfx image on latest master, I just discovered using ImportExampleGen on Kubeflow results in:
```
usage: container_entrypoint.py [-h] --exec_properties EXEC_PROPERTIES
                               --outputs OUTPUTS --executor_class_path
                               EXECUTOR_CLASS_PATH
                               {CsvExampleGen,BigQueryExampleGen,StatisticsGen,SchemaGen,ExampleValidator,Transform,Trainer,Evaluator,ModelValidator,Pusher}
                               ...
container_entrypoint.py: error: argument executor: invalid choice: 'ImportExampleGen' (choose from 'CsvExampleGen', 'BigQueryExampleGen', 'StatisticsGen', 'SchemaGen', 'ExampleValidator', 'Transform', 'Trainer', 'Evaluator', 'ModelValidator', 'Pusher')
```


Discussion:

Resolving patch:
diff --git a/tfx/orchestration/kubeflow/container_entrypoint.py b/tfx/orchestration/kubeflow/container_entrypoint.py
--- a/tfx/orchestration/kubeflow/container_entrypoint.py
+++ b/tfx/orchestration/kubeflow/container_entrypoint.py
@@ -51,6 +51,10 @@ def main():
   subparser.add_argument('--input_base', type=str, required=True)
   subparser.set_defaults(executor=wrappers.CsvExampleGenWrapper)
 
+  subparser = subparsers.add_parser('ImportExampleGen')
+  subparser.add_argument('--input_base', type=str, required=True)
+  subparser.set_defaults(executor=wrappers.ImportExampleGenWrapper)
+
   subparser = subparsers.add_parser('BigQueryExampleGen')
   subparser.set_defaults(executor=wrappers.BigQueryExampleGenWrapper)
 
diff --git a/tfx/orchestration/kubeflow/executor_wrappers.py b/tfx/orchestration/kubeflow/executor_wrappers.py
--- a/tfx/orchestration/kubeflow/executor_wrappers.py
+++ b/tfx/orchestration/kubeflow/executor_wrappers.py
@@ -158,6 +158,29 @@ def _set_input_artifact_span(self):
       input_artifact.span = span
 
 
+class ImportExampleGenWrapper(KubeflowExecutorWrapper):
+  """Wrapper for ImportExampleGen component."""
+
+  def __init__(self, args: argparse.Namespace):
+    super(ImportExampleGenWrapper, self).__init__(
+        executor_class_path=args.executor_class_path,
+        name='ImportExampleGen',
+        input_dict={
+            'input_base': parse_tfx_type(args.input_base),
+        },
+        outputs=args.outputs,
+        exec_properties=json.loads(args.exec_properties),
+    )
+    self._set_input_artifact_span()
+    self._set_outputs()
+
+  def _set_input_artifact_span(self):
+    for input_artifact in self._input_dict['input_base']:
+      matched = re.match(r'span_([0-9]+)', input_artifact.uri)
+      span = matched.group(1) if matched else 1
+      input_artifact.span = span
+
+
 class BigQueryExampleGenWrapper(KubeflowExecutorWrapper):
   """Wrapper for BigQueryExampleGen component."""
 


Test patch:
Repository: tensorflow/tfx

Issue:
`transform_output` not truely optional in 0.14.0 release
`transform_output` not truely optional for Trainer in 0.14.0 release. Culprit code is [here](https://github.com/tensorflow/tfx/blob/r0.14/tfx/components/trainer/executor.py#L148).


Discussion:

Resolving patch:
diff --git a/tfx/components/trainer/executor.py b/tfx/components/trainer/executor.py
--- a/tfx/components/trainer/executor.py
+++ b/tfx/components/trainer/executor.py
@@ -144,8 +144,8 @@ def Do(self, input_dict: Dict[Text, List[types.Artifact]],
             artifact_utils.get_split_uri(input_dict['examples'], 'train'))
     ]
     transform_output = artifact_utils.get_single_uri(
-        input_dict['transform_output']
-    ) if input_dict['transform_output'] else None
+        input_dict['transform_output']) if input_dict.get(
+            'transform_output', None) else None
     eval_files = [
         _all_files_pattern(
             artifact_utils.get_split_uri(input_dict['examples'], 'eval'))


Test patch:
Repository: tensorflow/tfx

Issue:
just a few typos fixed
That Python version check can be removed in a few days when Colab drops Python 2 support.


Discussion:

Resolving patch:
diff --git a/tfx/examples/custom_components/slack/example/taxi_pipeline_slack_kubeflow.py b/tfx/examples/custom_components/slack/example/taxi_pipeline_slack_kubeflow.py
--- a/tfx/examples/custom_components/slack/example/taxi_pipeline_slack_kubeflow.py
+++ b/tfx/examples/custom_components/slack/example/taxi_pipeline_slack_kubeflow.py
@@ -145,7 +145,7 @@ def _create_pipeline():
       slack_channel_id=_slack_channel_id,
       timeout_sec=3600,
   )
- # Checks whether the model passed the validation steps and pushes the model
+  # Checks whether the model passed the validation steps and pushes the model
   # to a file destination if check passed.
   pusher = Pusher(
       model=trainer.outputs['model'],


Test patch:
Repository: tensorflow/tfx

Issue:
Project can't be cloned correctly on macOS due to case insensitivity
Under the `tfx` folder there's a folder called `build` and a bazel file called `BUILD`. Because macOS is by default case insensitive, only the folder is cloned when `git clone` is run. This means that when trying to build locally, bazel won't be able to find the `BUILD` file required to compile the protobuf schemas, and will fail.


Discussion:
Looks like the same issue as me :) https://github.com/tensorflow/tfx/issues/2168

Thanks for finding out why this was happening!
Thanks for reporting the cause for the issues!

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -108,7 +108,7 @@ def finalize_options(self):
 
   def run(self):
     subprocess.check_call(
-        [self._bazel_cmd, 'run', '//tfx/build:gen_proto'],
+        [self._bazel_cmd, 'run', '//build:gen_proto'],
         # Bazel should be invoked in a directory containing bazel WORKSPACE
         # file, which is the root directory.
         cwd=os.path.dirname(os.path.realpath(__file__)),)


Test patch:
Repository: tensorflow/tfx

Issue:
TFX 0.24 fails on/after trainer step in interactive run
The typical TFX pipeline fails with a kernel restart after the trainer is run for the first time.

For example, when running the following colab, the kernel restarts if the trainer step is re-run. 
https://colab.research.google.com/github/tensorflow/tfx/blob/master/docs/tutorials/tfx/components_keras.ipynb#scrollTo=429-vvCWibO0

The runtime logs list this error:
> 
> Oct 5, 2020, 4:05:08 PM | WARNING | WARNING:root:kernel 31895490-d985-4a77-9518-021f4be051b0 restarted
> -- | -- | --
> Oct 5, 2020, 4:05:08 PM | INFO | KernelRestarter: restarting kernel (1/5), keep random ports
> Oct 5, 2020, 4:05:07 PM | WARNING | 2020-10-05 14:05:07.377834: F ml_metadata/metadata_store/query_config_executor.cc:299] Unexpected oneof:
> 



Discussion:
@lyschoening Please downgrade to tfx 0.22 and let me know if the issue still persists. Thanks!
Any story moving forward? This is blocking upgrade.
@gowthamkpr This issue does not occur in TFX 0.22, only in TFX 0.24. 

I ran the above Colab substituting `!pip install tfx` for `!pip install  tfx==0.22.1 apache-beam==2.21.0` and that works without issues. (The TFX 0.22 install is broken in a different way, as it depends on `apache-beam[gcp]>=2.21,<3`, yet is incompatible with `2.24.0`.)
@Iyschoening This is a know issue and will be fixed in the next release. Thanks!
@gowthamkpr do we have any ETA for that release? 
CC: @hughmiao 
Hi @gowthamkpr @charlesccychen @hughmiao do we have any updates on the ETA? This blocks upgrade if we can't run training reliably. Thanks
This will be fixed in https://github.com/tensorflow/tfx/pull/2652.  We will need a patch release to resolve this issue.

CC: @zhitaoli @dhruvesh09 

Resolving patch:
diff --git a/tfx/types/artifact.py b/tfx/types/artifact.py
--- a/tfx/types/artifact.py
+++ b/tfx/types/artifact.py
@@ -468,10 +468,14 @@ def has_custom_property(self, key: Text) -> bool:
 
   def get_string_custom_property(self, key: Text) -> Text:
     """Get a custom property of string type."""
+    if key not in self._artifact.custom_properties:
+      return ''
     return self._artifact.custom_properties[key].string_value
 
   def get_int_custom_property(self, key: Text) -> int:
     """Get a custom property of int type."""
+    if key not in self._artifact.custom_properties:
+      return 0
     return self._artifact.custom_properties[key].int_value
 
   def copy_from(self, other: 'Artifact'):


Test patch:
diff --git a/tfx/types/artifact_test.py b/tfx/types/artifact_test.py
--- a/tfx/types/artifact_test.py
+++ b/tfx/types/artifact_test.py
@@ -279,6 +279,9 @@ def testArtifactProperties(self):
     self.assertEqual(my_artifact.int2, 222)
     self.assertEqual(my_artifact.string1, '111')
     self.assertEqual(my_artifact.string2, '222')
+    self.assertEqual(my_artifact.get_string_custom_property('invalid'), '')
+    self.assertEqual(my_artifact.get_int_custom_property('invalid'), 0)
+    self.assertNotIn('invalid', my_artifact._artifact.custom_properties)
 
     with self.assertRaisesRegexp(
         AttributeError, "Cannot set unknown property 'invalid' on artifact"):
Repository: tensorflow/tfx

Issue:
RuntimeParameter ignores zero-valued defaults
`RuntimeParameter` defaults do not get stored in Kubeflow pipeline package definitions when the default is zero-valued

`foo = data_types.RuntimeParameter('foo', default=0.0, ptype=float)`

Compiles to
```
    pipelines.kubeflow.org/pipeline_spec: >-
      {"inputs": [{"name": "foo"}], "name": "...", ...}
```

Expected would be
```
    pipelines.kubeflow.org/pipeline_spec: >-
      {"inputs": [{"name": "foo", "default": 0.0}], "name": "...", ...}
```


Discussion:
I believe the actual issue is that in KFP the default value of parameter is recognized as strings [1]. However when `0.0` or `False` being passed to the constructor [this line](https://github.com/kubeflow/pipelines/blob/f65391309650fdc967586529e79af178241b4c2c/sdk/python/kfp/dsl/_pipeline_param.py#L168) will ignore them.

I can try to put together a fix shortly. Thanks for catching this!


[1] https://github.com/kubeflow/pipelines/blob/f65391309650fdc967586529e79af178241b4c2c/sdk/python/kfp/dsl/_pipeline_param.py#L154

Resolving patch:
diff --git a/tfx/orchestration/kubeflow/kubeflow_dag_runner.py b/tfx/orchestration/kubeflow/kubeflow_dag_runner.py
--- a/tfx/orchestration/kubeflow/kubeflow_dag_runner.py
+++ b/tfx/orchestration/kubeflow/kubeflow_dag_runner.py
@@ -282,8 +282,13 @@ def _parse_parameter_from_component(
         continue
       if parameter.name not in self._deduped_parameter_names:
         self._deduped_parameter_names.add(parameter.name)
+        # TODO(b/178436919): Create a test to cover default value rendering
+        # and move the external code reference over there.
+        # The default needs to be serialized then passed to dsl.PipelineParam.
+        # See
+        # https://github.com/kubeflow/pipelines/blob/f65391309650fdc967586529e79af178241b4c2c/sdk/python/kfp/dsl/_pipeline_param.py#L154
         dsl_parameter = dsl.PipelineParam(
-            name=parameter.name, value=parameter.default)
+            name=parameter.name, value=str(parameter.default))
         self._params.append(dsl_parameter)
 
   def _parse_parameter_from_pipeline(self,


Test patch:
Repository: tensorflow/tfx

Issue:
Update tensorflow-hub requirement to allow 0.12.0?
If the feature is related to a specific library below, please raise an issue in
the respective repo directly:

[TensorFlow Data Validation Repo](https://github.com/tensorflow/data-validation/issues)

[TensorFlow Model Analysis Repo](https://github.com/tensorflow/model-analysis/issues)

[TensorFlow Transform Repo](https://github.com/tensorflow/transform/issues)

[TensorFlow Serving Repo](https://github.com/tensorflow/serving/issues)

**System information**

- TFX Version (you are using):  1.0.0-rc0
- Environment in which you plan to use the feature (e.g., Local
  (Linux/MacOS/Windows), Interactive Notebook, Google Cloud, etc..): MacOS, AWS
- Are you willing to contribute it (Yes/No): Yes

**Describe the feature and the current behavior/state.**
tfx (1.0.0-rc0) currently depends on tensorflow-hub (>=0.9.0,<0.10)

I was wondering if we could update tensorflow-hub dependancy for tfx to allow tf-hub 0.12.0, so something like (>=0.9.0,<=0.12.0)?

I am not sure if that would break anything in tfx, but I am happy to investigate and contribute to this change

**Will this change the current API? How?**
No

**Who will benefit with this feature?**
tensorflow-hub has added some new features in 0.10.0 and beyond (specifically the one I'm interested in "`compute_output_shape` in `hub.KerasLayer`" which they added in 0.12.0). It would be cool to be able to take advantage of those while still being able to use tfx

**Do you have a workaround or are completely blocked by this?** :
Blocked

**Name of your Organization (Optional)**


**Any Other info.**



Discussion:

Resolving patch:
diff --git a/tfx/dependencies.py b/tfx/dependencies.py
--- a/tfx/dependencies.py
+++ b/tfx/dependencies.py
@@ -88,7 +88,7 @@ def make_required_install_packages():
       'pyarrow>=1,<3',
       'pyyaml>=3.12,<6',
       'tensorflow>=1.15.2,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3',
-      'tensorflow-hub>=0.9.0,<0.10',
+      'tensorflow-hub>=0.9.0,<=0.12.0',
       'tensorflow-data-validation' + select_constraint(
           default='>=0.30,<0.31',
           nightly='>=0.31.0.dev',


Test patch:
Repository: tensorflow/tfx

Issue:
Update tensorflow-hub requirement to allow 0.12.0?
If the feature is related to a specific library below, please raise an issue in
the respective repo directly:

[TensorFlow Data Validation Repo](https://github.com/tensorflow/data-validation/issues)

[TensorFlow Model Analysis Repo](https://github.com/tensorflow/model-analysis/issues)

[TensorFlow Transform Repo](https://github.com/tensorflow/transform/issues)

[TensorFlow Serving Repo](https://github.com/tensorflow/serving/issues)

**System information**

- TFX Version (you are using):  1.0.0-rc0
- Environment in which you plan to use the feature (e.g., Local
  (Linux/MacOS/Windows), Interactive Notebook, Google Cloud, etc..): MacOS, AWS
- Are you willing to contribute it (Yes/No): Yes

**Describe the feature and the current behavior/state.**
tfx (1.0.0-rc0) currently depends on tensorflow-hub (>=0.9.0,<0.10)

I was wondering if we could update tensorflow-hub dependancy for tfx to allow tf-hub 0.12.0, so something like (>=0.9.0,<=0.12.0)?

I am not sure if that would break anything in tfx, but I am happy to investigate and contribute to this change

**Will this change the current API? How?**
No

**Who will benefit with this feature?**
tensorflow-hub has added some new features in 0.10.0 and beyond (specifically the one I'm interested in "`compute_output_shape` in `hub.KerasLayer`" which they added in 0.12.0). It would be cool to be able to take advantage of those while still being able to use tfx

**Do you have a workaround or are completely blocked by this?** :
Blocked

**Name of your Organization (Optional)**


**Any Other info.**



Discussion:
Thanks @suryaavala. We missed to keep the dependency constraint up to date.
No worries @chongkong! 

I've already opened a PR ([#3813](https://github.com/tensorflow/tfx/pull/3813)) with the issue to update the dependency. Looks like you might have missed it and created another one. Should I close mine in favour of yours?
Oh sorry I missed your PR. Will use your's.

Resolving patch:
diff --git a/tfx/dependencies.py b/tfx/dependencies.py
--- a/tfx/dependencies.py
+++ b/tfx/dependencies.py
@@ -88,7 +88,7 @@ def make_required_install_packages():
       'pyarrow>=1,<3',
       'pyyaml>=3.12,<6',
       'tensorflow>=1.15.2,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3',
-      'tensorflow-hub>=0.9.0,<=0.12.0',
+      'tensorflow-hub>=0.9.0,<0.13',
       'tensorflow-data-validation' + select_constraint(
           default='>=1.0.0,<1.1.0',
           nightly='>=1.1.0.dev',


Test patch:
Repository: tensorflow/tfx

Issue:
Update tensorflow-hub requirement to allow 0.12.0?
If the feature is related to a specific library below, please raise an issue in
the respective repo directly:

[TensorFlow Data Validation Repo](https://github.com/tensorflow/data-validation/issues)

[TensorFlow Model Analysis Repo](https://github.com/tensorflow/model-analysis/issues)

[TensorFlow Transform Repo](https://github.com/tensorflow/transform/issues)

[TensorFlow Serving Repo](https://github.com/tensorflow/serving/issues)

**System information**

- TFX Version (you are using):  1.0.0-rc0
- Environment in which you plan to use the feature (e.g., Local
  (Linux/MacOS/Windows), Interactive Notebook, Google Cloud, etc..): MacOS, AWS
- Are you willing to contribute it (Yes/No): Yes

**Describe the feature and the current behavior/state.**
tfx (1.0.0-rc0) currently depends on tensorflow-hub (>=0.9.0,<0.10)

I was wondering if we could update tensorflow-hub dependancy for tfx to allow tf-hub 0.12.0, so something like (>=0.9.0,<=0.12.0)?

I am not sure if that would break anything in tfx, but I am happy to investigate and contribute to this change

**Will this change the current API? How?**
No

**Who will benefit with this feature?**
tensorflow-hub has added some new features in 0.10.0 and beyond (specifically the one I'm interested in "`compute_output_shape` in `hub.KerasLayer`" which they added in 0.12.0). It would be cool to be able to take advantage of those while still being able to use tfx

**Do you have a workaround or are completely blocked by this?** :
Blocked

**Name of your Organization (Optional)**


**Any Other info.**



Discussion:

Resolving patch:
diff --git a/tfx/dependencies.py b/tfx/dependencies.py
--- a/tfx/dependencies.py
+++ b/tfx/dependencies.py
@@ -88,7 +88,7 @@ def make_required_install_packages():
       'pyarrow>=1,<3',
       'pyyaml>=3.12,<6',
       'tensorflow>=1.15.2,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3',
-      'tensorflow-hub>=0.9.0,<0.10',
+      'tensorflow-hub>=0.9.0,<=0.12.0',
       'tensorflow-data-validation' + select_constraint(
           default='>=1.0.0,<1.1.0',
           nightly='>=1.1.0.dev',
@@ -97,8 +97,7 @@ def make_required_install_packages():
       'tensorflow-model-analysis' + select_constraint(
           default='>=0.31,<0.32',
           nightly='>=0.32.0.dev',
-          git_master='@git+https://github.com/tensorflow/model-analysis@master'
-      ),
+          git_master='@git+https://github.com/tensorflow/model-analysis@master'),
       'tensorflow-serving-api>=1.15,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3',
       'tensorflow-transform' + select_constraint(
           default='>=1.0.0,<1.1.0',


Test patch:
Repository: kivy/kivy

Issue:
Async Image crash when source is set to '' while loader.gif is animating
Steps to reproduce:

1) Run the AsyncImage example in the examples/widgets directory with the inspector module
2) After it's done loading the file from the Internet, load the Inspector module
3) Change the source property to some random characters
4) Now while the loader.gif is animating Change the source to '' (0 length string)
5) Profit !!



Discussion:

Resolving patch:
diff --git a/kivy/uix/image.py b/kivy/uix/image.py
--- a/kivy/uix/image.py
+++ b/kivy/uix/image.py
@@ -237,6 +237,7 @@ def __init__(self, **kwargs):
 
     def on_source(self, instance, value):
         if not value:
+            self._coreimage.unbind(on_texture=self._on_tex_change)
             self.texture = None
             self._coreimage = None
         else:
@@ -258,4 +259,5 @@ def is_uri(self, filename):
         return proto in ('http', 'https', 'ftp')
 
     def _on_tex_change(self, *largs):
-        self.texture = self._coreimage.texture
+        if self._coreimage:
+            self.texture = self._coreimage.texture


Test patch:
Repository: kivy/kivy

Issue:
Regression when upgrading from 1.0.9-stable to 1.0.10-dev?
Hello,

I just upgraded Kivy to the latest version via the "git pull" command. I was running 1.0.9 stable and updated Kivy to 1.0.10-dev.

When rerunning my program (on 1.0.9 everything works just fine), this error / stacktrace pops up: http://dpaste.com/hold/676134/.



Discussion:

Resolving patch:
diff --git a/kivy/uix/image.py b/kivy/uix/image.py
--- a/kivy/uix/image.py
+++ b/kivy/uix/image.py
@@ -237,7 +237,8 @@ def __init__(self, **kwargs):
 
     def on_source(self, instance, value):
         if not value:
-            self._coreimage.unbind(on_texture=self._on_tex_change)
+            if self._coreimage is not None:
+                self._coreimage.unbind(on_texture=self._on_tex_change)
             self.texture = None
             self._coreimage = None
         else:


Test patch: