ValueError: Classification metrics can't handle a mix of unknown and binary targets : 0 and 1 Predictions

I am constructing confusion matrix based on prediction and ground truth. Previously, it worked fine on Python 3.5 but now Python 3.5 is unavailable. So I have to install python 3.7 for better working.

Code

predictions = gbm.predict(x_test)
predictions_classes = []
for i in predictions:
    prediction_class = np.argmax(i)
    predictions_classes.append(prediction_class)

cm = confusion_matrix(y_test, predictions_classes, normalize=False)
print(cm)

tn, fp, fn, tp = cm.ravel()

recall = tp / (tp + fn)
precision = tp / (tp + fp)
accuracy = (tp + tn) / (tn + fp + fn + tp)
f1 = 2 * (precision * recall) / (precision + recall)

print("Precision: ", 100 * precision, "%")
print("Recall: ", 100 * recall, "%")
print("F1 score ", 100 * f1, "%")
print("Accuracy: ", 100 * accuracy, "%")
**Traceback (most recent call last):**
  File "/home/khawar/deepface/tests/Ensemble-Face-Recognition.py", line 846, in <module>
    cm = confusion_matrix(y_test, predictions_classes, normalize=False)
  File "/home/khawar/anaconda3/envs/deepface/lib/python3.7/site-packages/sklearn/utils/validation.py", line 72, in inner_f
    return f(**kwargs)
  File "/home/khawar/anaconda3/envs/deepface/lib/python3.7/site-packages/sklearn/metrics/_classification.py", line 276, in confusion_matrix
    y_type, y_true, y_pred = _check_targets(y_true, y_pred)
  File "/home/khawar/anaconda3/envs/deepface/lib/python3.7/site-packages/sklearn/metrics/_classification.py", line 91, in _check_targets
    "and {1} targets".format(type_true, type_pred))
ValueError: Classification metrics can't handle a mix of unknown and binary targets

I’m not sure if this question is PyTorch-specific or rather targets sklearn or Python.
If your code is working fine in Python==3.7, I guess some underlying libraries, such as numpy or sklearn, were also updated?