huanghuidmml / tfbert

基于tensorflow1.x的预训练模型调用,支持单机多卡、梯度累积,XLA加速,混合精度。可灵活训练、验证、预测。
58 stars 11 forks source link

I got those error when I was run the python file of run_element_extract.py. #3

Closed ericdoug-qi closed 3 years ago

ericdoug-qi commented 3 years ago

/opt/conda/lib/python3.7/site-packages/numpy/core/_asarray.py:83: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray return array(a, dtype, copy=False, order=order) Traceback (most recent call last): File "run_element_extract.py", line 277, in main() File "run_element_extract.py", line 234, in main trainer.build_model(model_fn=get_model_fn(config, args)) File "/opt/tfbert/tfbert/trainer.py", line 621, in build_model model_output = model_fn(inputs, True) File "run_element_extract.py", line 126, in model_fn **inputs File "/opt/tfbert/tfbert/models/for_task.py", line 173, in init compute_type=compute_type File "/opt/tfbert/tfbert/models/bert.py", line 152, in init input_shape = model_utils.get_shape_list(input_ids, expected_rank=2) File "/opt/tfbert/tfbert/models/model_utils.py", line 196, in get_shape_list assert_rank(tensor, expected_rank, name) File "/opt/tfbert/tfbert/models/model_utils.py", line 241, in assert_rank (name, scope_name, actual_rank, str(tensor.shape), str(expected_rank))) ValueError: For the tensor IteratorGetNext:1 in scope `, the actual rank1(shape = (?,)) is not equal to the expected rank

huanghuidmml commented 3 years ago

/opt/conda/lib/python3.7/site-packages/numpy/core/_asarray.py:83: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray return array(a, dtype, copy=False, order=order) Traceback (most recent call last): File "run_element_extract.py", line 277, in main() File "run_element_extract.py", line 234, in main trainer.build_model(model_fn=get_model_fn(config, args)) File "/opt/tfbert/tfbert/trainer.py", line 621, in build_model model_output = model_fn(inputs, True) File "run_element_extract.py", line 126, in model_fn inputs File "/opt/tfbert/tfbert/models/for_task.py", line 173, in init compute_type=compute_type File "/opt/tfbert/tfbert/models/bert.py", line 152, in init** input_shape = model_utils.get_shape_list(input_ids, expected_rank=2) File "/opt/tfbert/tfbert/models/model_utils.py", line 196, in get_shape_list assert_rank(tensor, expected_rank, name) File "/opt/tfbert/tfbert/models/model_utils.py", line 241, in assert_rank (name, scope_name, actual_rank, str(tensor.shape), str(expected_rank))) ValueError: For the tensor IteratorGetNext:1 in scope `, the actual rank1(shape = (?,)) is not equal to the expected rank

Sorry, there was an error in the previous data processing. It has been fixed in the new code.

ericdoug-qi commented 3 years ago

Yes, Thanks for your fix timely.