Open hanzigs opened 4 years ago
It is the TensorFlow/Keras conflict. It can be solved with the the downgrading method as follows.
!pip install q keras==2.2.4 !pip install q tensorflow==1.14.0
However, it would be much better if Andre had free time to upgrade the lines of code. The reason is that the major shuffle in the industry is to adopt to TensorFlow2.0/Keras 2.3(or tf.keras).
The major issue is whether it gives explicit or implicit valuation in the context of TensorFlow 2.x/Keras 2.3. If the valuation is explicit(direct) and does not involve the other complex callbacks, it will be easy to solve the issue. However, the author has adopted the implicit(or indirect) recursive evaluation, including def dl_pipeline_fit_score_results(...)
and evaluation with the statement dl_pipeline_fit_score_results(...)
. So the Python Interpreter confuses the evaluation of the defined statement as follows.
dl_pipeline_fit_score_results(dl_pipeline=dl_pipeline,
train_data=train_data,
test_data=test_data,
label='label_index');
It has the same result even though I use the print statement with flush=True
print(dl_pipeline_fit_score_results(dl_pipeline=dl_pipeline,train_data=train_data, \
test_data=test_data, label='label_index'), flush=True)
It is also generate same issue while I remove the eight statements from In [23] as follows.
pred_train = fit_dl_pipeline.transform(train_data)
pred_test = fit_dl_pipeline.transform(test_data)
pnl_train = pred_train.select(label, "prediction")
pnl_test = pred_test.select(label, "prediction")
pred_and_label_train = pnl_train.rdd.map(lambda row: (row[label], row['prediction']))
pred_and_label_test = pnl_test.rdd.map(lambda row: (row[label], row['prediction']))
metrics_train = MulticlassMetrics(pred_and_label_train)
metrics_test = MulticlassMetrics(pred_and_label_test)
While I try to move the eight statements from the defined dl_pipeline_fit_score_results(...) to other place, it generates the error such as "NameError: name 'pred_train' is not defined" or "NameError: name 'pnl_train' is not defined" . That means variables are local variables. It complies with the LEGB rules.
Thererefore, it is quite hard to correct the issue of "PicklingError: Could not serialize object: ValueError: substring not found" in the context of TensorFlow 2.x/Keras 2.3.
It would be good if the author spared his time to change it in adapting to the context of TensorFlow 2.x/Keras 2.3.
While fitting traind_data, getting PicklingError, can you help on this, Thanks