Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with generating predictions from fine tuned classification model #270

Open
abdullahkhilji opened this issue Sep 6, 2020 · 0 comments

Comments

@abdullahkhilji
Copy link

Instructions for updating:
Use `tf.data.experimental.map_and_batch(...)`.
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:memory input None
INFO:tensorflow:Use float type <dtype: 'float32'>
Traceback (most recent call last):
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1805, in zeros
    output = _constant_if_small(zero, shape, dtype, name)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1762, in _constant_if_small
    if np.prod(shape) < 1000:
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 2772, in prod
    initial=initial)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 815, in binary_op_wrapper
    y = ops.convert_to_tensor(y, dtype=x.dtype.base_dtype, name="y")
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1039, in convert_to_tensor
    return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1097, in convert_to_tensor_v2
    as_ref=False)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1175, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 357, in _dimension_tensor_conversion_function
    raise ValueError("Cannot convert an unknown Dimension to a Tensor: %s" % d)
ValueError: Cannot convert an unknown Dimension to a Tensor: ?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_classifier.py", line 855, in <module>
    tf.app.run()
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "run_classifier.py", line 824, in main
    checkpoint_path=FLAGS.predict_ckpt)):
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 611, in predict
    features, None, model_fn_lib.ModeKeys.PREDICT, self.config)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1112, in _call_model_fn
    model_fn_results = self._model_fn(features=features, **kwargs)
  File "run_classifier.py", line 523, in model_fn
    FLAGS, features, n_class, is_training)
  File "/home/abdullahkhilji/GitHub/xlnet/function_builder.py", line 152, in get_classification_loss
    input_mask=inp_mask)
  File "/home/abdullahkhilji/GitHub/xlnet/xlnet.py", line 222, in __init__
    ) = modeling.transformer_xl(**tfm_args)
  File "/home/abdullahkhilji/GitHub/xlnet/modeling.py", line 498, in transformer_xl
    dtype=tf_float)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1814, in zeros
    shape = ops.convert_to_tensor(shape, dtype=dtypes.int32)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1039, in convert_to_tensor
    return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1097, in convert_to_tensor_v2
    as_ref=False)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1175, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1102, in _autopacking_conversion_function
    return _autopacking_helper(v, dtype, name or "packed")
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1053, in _autopacking_helper
    constant_op.constant(elem, dtype=dtype, name=str(i)))
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 245, in constant
    allow_broadcast=True)
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 283, in _constant_impl
    allow_broadcast=allow_broadcast))
  File "/home/abdullahkhilji/miniconda3/envs/xlnet/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 467, in make_tensor_proto
    nparray = np.array(values, dtype=np_dt)
TypeError: __int__ returned non-int (type NoneType)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant