tensorflow: TF 2.0 crossed_column on Windows fails with SystemError: returned a result with an error set

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 Home
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): v1.12.0-9492-g2c319fb415 2.0.0-alpha0
  • Python version: 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
  • Bazel version (if compiling from source): NA
  • GCC/Compiler version (if compiling from source): NA
  • CUDA/cuDNN version: NA
  • GPU model and memory: NA

You can collect some of this information using our environment capture script You can also obtain the TensorFlow version with: 1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)" 2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior The code snippets works fine on Colab but gives the following error on Windows:

OverflowError: Python int too large to convert to C long
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-6-6cfdea12e863>", line 44, in <module>
    demo(feature_column.indicator_column(crossed_feature))
  File "<ipython-input-6-6cfdea12e863>", line 36, in demo
    print(feature_layer(example_batch))
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 660, in __call__
    outputs = self.call(inputs, *args, **kwargs)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\feature_column\feature_column_v2.py", line 473, in call
    self._state_manager)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\feature_column\feature_column_v2.py", line 4391, in get_dense_tensor
    return transformation_cache.get(self, state_manager)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\feature_column\feature_column_v2.py", line 2573, in get
    transformed = column.transform_feature(self, state_manager)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\feature_column\feature_column_v2.py", line 4330, in transform_feature
    transformation_cache, state_manager)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\feature_column\feature_column_v2.py", line 4184, in get_sparse_tensors
    transformation_cache.get(self, state_manager), None)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\feature_column\feature_column_v2.py", line 2573, in get
    transformed = column.transform_feature(self, state_manager)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\feature_column\feature_column_v2.py", line 4145, in transform_feature
    hash_key=self.hash_key)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\sparse_ops.py", line 564, in sparse_cross_hashed
    name=name)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\sparse_ops.py", line 617, in _sparse_cross_internal
    name=name)
  File "C:\Users\user\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\gen_sparse_ops.py", line 1372, in sparse_cross
    "internal_type", internal_type)
SystemError: <built-in function TFE_Py_FastPathExecute> returned a result with an error set

Executing:

import sys
sys.maxsize

gives: 9223372036854775807

Describe the expected behavior Same output as running on Colab:

image

Code to reproduce the issue

import tensorflow as tf
import pandas as pd

from tensorflow import feature_column
from tensorflow.keras import layers
from sklearn.model_selection import train_test_split

URL = 'https://storage.googleapis.com/applied-dl/heart.csv'
dataframe = pd.read_csv(URL)
dataframe.head()

train, test = train_test_split(dataframe, test_size=0.2)
train, val = train_test_split(train, test_size=0.2)

def df_to_dataset(dataframe, shuffle=True, batch_size=32):
  dataframe = dataframe.copy()
  labels = dataframe.pop('target')
  ds = tf.data.Dataset.from_tensor_slices((dict(dataframe), labels))
  if shuffle:
    ds = ds.shuffle(buffer_size=len(dataframe))
  ds = ds.batch(batch_size)
  return ds


batch_size = 5 # A small batch sized is used for demonstration purposes
train_ds = df_to_dataset(train, batch_size=batch_size)
val_ds = df_to_dataset(val, shuffle=False, batch_size=batch_size)
test_ds = df_to_dataset(test, shuffle=False, batch_size=batch_size)

example_batch = next(iter(train_ds))[0]

# A utility method to create a feature column
# and to transform a batch of data
def demo(feature_column):
  feature_layer = layers.DenseFeatures(feature_column)
  print(feature_layer(example_batch))

age = feature_column.numeric_column("age")
age_buckets = feature_column.bucketized_column(age, boundaries=[18, 25, 30, 35, 40, 45, 50, 55, 60, 65])
thal = feature_column.categorical_column_with_vocabulary_list(
      'thal', ['fixed', 'normal', 'reversible'])

crossed_feature = feature_column.crossed_column([age_buckets, thal], hash_bucket_size=3)
demo(feature_column.indicator_column(crossed_feature))

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 24 (7 by maintainers)

Most upvoted comments

I have the same issue following the same ‘Classify structured data’ tutorial. Same characteristics as the original poster, only I’m running tf on GPU.

Same here on 2.0 beta version

Same here.

@JerichoHy I created a new conda environment with tensorflow==2.0.0-rc1 installed but still get the same error.

‘OverflowError: Python int too large to convert to C long’ followed by traceback down to

'~\Miniconda3\lib\site-packages\tensorflow_core\python\ops\gen_sparse_ops.py in sparse_cross(indices, values, shapes, dense_inputs, hashed_output, num_buckets, hash_key, out_type, internal_type, name) 1147 shapes, dense_inputs, “hashed_output”, hashed_output, “num_buckets”, 1148 num_buckets, “hash_key”, hash_key, “out_type”, out_type, -> 1149 “internal_type”, internal_type) 1150 _result = _SparseCrossOutput._make(_result) 1151 return _result

SystemError: <built-in function TFE_Py_FastPathExecute> returned a result with an error set’

Happy to provide more info.

@hsm207 I tried to upgrade with pip install --upgrade tensorflow==2.0.0rc1, but problem existed stilly. Could you tell me how to upgrade to v2.0.0-rc0-101-gd2d2566eef 2.0.0-rc1. Thanks!

@JerichoHy I did not do an upgrade. I created a new conda environment and ran pip install tensorflow==2.0.0-rc1

Thanks.

@hsm207 I tried to upgrade with pip install --upgrade tensorflow==2.0.0rc1, but problem existed stilly. Could you tell me how to upgrade to v2.0.0-rc0-101-gd2d2566eef 2.0.0-rc1. Thanks!

I get the same error about the “Built-in function … returned a result with an error set” but refers to the function ‘TFE_Py_TapeWatch’. I find that all functions with ‘TFE’ are defined in pywrap_tensorflow_internal. So I try to import it on tape but the result is the same as before. Version: tensorflow-gpu== 2.1 beta Platform: Google Colab

I am having the same error… any solutions?