google / model_search

Apache License 2.0
3.26k stars 462 forks source link

InvalidArgumentError: Field 1 in record is not a valid int32 #38

Closed hitarth64 closed 3 years ago

hitarth64 commented 3 years ago

I was able to get the code running with the test data supplied with the module. Now, I am testing out the code with a custom dataset. However, the dataset isn't just composed of int32 entries but also has float entries. This is probably causing the following error: InvalidArgumentError: Field 1 in record is not a valid int32: 1.0000000007063299 Could you help me fix it? Is there a keyword in the csvdata module that will accommodate for floating point numbers in the inputs?

The full error trace is below:

`InvalidArgumentError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, args) 1374 try: -> 1375 return fn(args) 1376 except errors.OpError as e:

20 frames /usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata) 1359 return self._call_tf_sessionrun(options, feed_dict, fetch_list, -> 1360 target_list, run_metadata) 1361

/usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata) 1452 fetch_list, target_list, -> 1453 run_metadata) 1454

InvalidArgumentError: Field 1 in record is not a valid int32: 1.0000000007063299 [[{{node IteratorGetNext}}]]

During handling of the above exception, another exception occurred:

InvalidArgumentError Traceback (most recent call last)

in () 31 batch_size=32, 32 experiment_name="example", ---> 33 experiment_owner="model_search_user") /content/drive/My Drive/oqmd_structures/sony/search/model_search/single_trainer.py in try_models(self, number_models, train_steps, eval_steps, root_dir, batch_size, experiment_name, experiment_owner) 84 train_steps=train_steps, 85 eval_steps=eval_steps, ---> 86 batch_size=batch_size): 87 pass /content/drive/My Drive/oqmd_structures/sony/search/model_search/oss_trainer_lib.py in run_parameterized_train_and_eval(phoenix_instance, oracle, tuner_id, root_dir, max_trials, data_provider, train_steps, eval_steps, batch_size) 338 train_steps=train_steps, 339 eval_steps=eval_steps, --> 340 batch_size=batch_size) 341 342 oracle.update_trial( /content/drive/My Drive/oqmd_structures/sony/search/model_search/oss_trainer_lib.py in run_train_and_eval(hparams, model_dir, phoenix_instance, data_provider, train_steps, eval_steps, batch_size) 240 mode=tf.estimator.ModeKeys.TRAIN, 241 batch_size=batch_size), --> 242 max_steps=train_steps) 243 tf.compat.v1.reset_default_graph() 244 tf.keras.backend.clear_session() /usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py in train(self, input_fn, hooks, steps, max_steps, saving_listeners) 347 348 saving_listeners = _check_listeners_type(saving_listeners) --> 349 loss = self._train_model(input_fn, hooks, saving_listeners) 350 logging.info('Loss for final step: %s.', loss) 351 return self /usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py in _train_model(self, input_fn, hooks, saving_listeners) 1173 return self._train_model_distributed(input_fn, hooks, saving_listeners) 1174 else: -> 1175 return self._train_model_default(input_fn, hooks, saving_listeners) 1176 1177 def _train_model_default(self, input_fn, hooks, saving_listeners): /usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py in _train_model_default(self, input_fn, hooks, saving_listeners) 1206 return self._train_with_estimator_spec(estimator_spec, worker_hooks, 1207 hooks, global_step_tensor, -> 1208 saving_listeners) 1209 1210 def _train_model_distributed(self, input_fn, hooks, saving_listeners): /usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py in _train_with_estimator_spec(self, estimator_spec, worker_hooks, hooks, global_step_tensor, saving_listeners) 1512 any_step_done = False 1513 while not mon_sess.should_stop(): -> 1514 _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss]) 1515 any_step_done = True 1516 if not any_step_done: /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/monitored_session.py in run(self, fetches, feed_dict, options, run_metadata) 776 feed_dict=feed_dict, 777 options=options, --> 778 run_metadata=run_metadata) 779 780 def run_step_fn(self, step_fn): /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/monitored_session.py in run(self, fetches, feed_dict, options, run_metadata) 1281 feed_dict=feed_dict, 1282 options=options, -> 1283 run_metadata=run_metadata) 1284 except _PREEMPTION_ERRORS as e: 1285 logging.info( /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/monitored_session.py in run(self, *args, **kwargs) 1382 raise six.reraise(*original_exc_info) 1383 else: -> 1384 raise six.reraise(*original_exc_info) 1385 1386 /usr/local/lib/python3.7/dist-packages/six.py in reraise(tp, value, tb) 701 if value.__traceback__ is not tb: 702 raise value.with_traceback(tb) --> 703 raise value 704 finally: 705 value = None /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/monitored_session.py in run(self, *args, **kwargs) 1367 def run(self, *args, **kwargs): 1368 try: -> 1369 return self._sess.run(*args, **kwargs) 1370 except _PREEMPTION_ERRORS: 1371 raise /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/monitored_session.py in run(self, fetches, feed_dict, options, run_metadata) 1440 feed_dict=feed_dict, 1441 options=options, -> 1442 run_metadata=run_metadata) 1443 1444 for hook in self._hooks: /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/monitored_session.py in run(self, *args, **kwargs) 1198 1199 def run(self, *args, **kwargs): -> 1200 return self._sess.run(*args, **kwargs) 1201 1202 def run_step_fn(self, step_fn, raw_session, run_with_hooks): /usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata) 966 try: 967 result = self._run(None, fetches, feed_dict, options_ptr, --> 968 run_metadata_ptr) 969 if run_metadata: 970 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr) /usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata) 1189 if final_fetches or final_targets or (handle and feed_dict_tensor): 1190 results = self._do_run(handle, final_targets, final_fetches, -> 1191 feed_dict_tensor, options, run_metadata) 1192 else: 1193 results = [] /usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1367 if handle is None: 1368 return self._do_call(_run_fn, feeds, fetches, targets, options, -> 1369 run_metadata) 1370 else: 1371 return self._do_call(_prun_fn, handle, feeds, fetches) /usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args) 1392 '\nsession_config.graph_options.rewrite_options.' 1393 'disable_meta_optimizer = True') -> 1394 raise type(e)(node_def, op, message) 1395 1396 def _extend_graph(self): InvalidArgumentError: Field 1 in record is not a valid int32: 1.0000000007063299 [[node IteratorGetNext (defined at /usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/util.py:61) ]] Errors may have originated from an input operation. Input Source operations connected to node IteratorGetNext: IteratorV2 (defined at /usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/util.py:59) Original stack trace for 'IteratorGetNext': File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py", line 16, in app.launch_new_instance() File "/usr/local/lib/python3.7/dist-packages/traitlets/config/application.py", line 845, in launch_instance app.start() File "/usr/local/lib/python3.7/dist-packages/ipykernel/kernelapp.py", line 499, in start self.io_loop.start() File "/usr/local/lib/python3.7/dist-packages/tornado/platform/asyncio.py", line 132, in start self.asyncio_loop.run_forever() File "/usr/lib/python3.7/asyncio/base_events.py", line 541, in run_forever self._run_once() File "/usr/lib/python3.7/asyncio/base_events.py", line 1786, in _run_once handle._run() File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.7/dist-packages/tornado/platform/asyncio.py", line 122, in _handle_events handler_func(fileobj, events) File "/usr/local/lib/python3.7/dist-packages/tornado/stack_context.py", line 300, in null_wrapper return fn(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/zmq/eventloop/zmqstream.py", line 451, in _handle_events self._handle_recv() File "/usr/local/lib/python3.7/dist-packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv self._run_callback(callback, msg) File "/usr/local/lib/python3.7/dist-packages/zmq/eventloop/zmqstream.py", line 434, in _run_callback callback(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/tornado/stack_context.py", line 300, in null_wrapper return fn(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher return self.dispatch_shell(stream, msg) File "/usr/local/lib/python3.7/dist-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell handler(stream, idents, msg) File "/usr/local/lib/python3.7/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request user_expressions, allow_stdin) File "/usr/local/lib/python3.7/dist-packages/ipykernel/ipkernel.py", line 208, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "/usr/local/lib/python3.7/dist-packages/ipykernel/zmqshell.py", line 537, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py", line 2718, in run_cell interactivity=interactivity, compiler=compiler, result=result) File "/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py", line 2828, in run_ast_nodes if self.run_code(code, result): File "/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 33, in experiment_owner="model_search_user") File "search/model_search/single_trainer.py", line 86, in try_models batch_size=batch_size): File "search/model_search/oss_trainer_lib.py", line 340, in run_parameterized_train_and_eval batch_size=batch_size) File "search/model_search/oss_trainer_lib.py", line 242, in run_train_and_eval max_steps=train_steps) File "/usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 349, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 1175, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 1201, in _train_model_default self._get_features_and_labels_from_input_fn(input_fn, ModeKeys.TRAIN)) File "/usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/estimator.py", line 1037, in _get_features_and_labels_from_input_fn self._call_input_fn(input_fn, mode)) File "/usr/local/lib/python3.7/dist-packages/tensorflow_estimator/python/estimator/util.py", line 61, in parse_input_fn_result result = iterator.get_next() File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/data/ops/iterator_ops.py", line 419, in get_next name=name) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/gen_dataset_ops.py", line 2601, in iterator_get_next output_shapes=output_shapes, name=name) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 750, in _apply_op_helper attrs=attr_protos, op_def=op_def) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", line 3536, in _create_op_internal op_def=op_def) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", line 1990, in __init__ self._traceback = tf_stack.extract_stack()`
praneethkv commented 3 years ago

give float default value for float features when initializing the traine., then it understands that particular feature as float. for example 0 for integer feature and 0.0 for float features, which should work