Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

model.fit makes the kernel crash when passing a class_weight #275

Open
atn832 opened this issue May 29, 2021 · 0 comments
Open

model.fit makes the kernel crash when passing a class_weight #275

atn832 opened this issue May 29, 2021 · 0 comments

Comments

@atn832
Copy link

atn832 commented May 29, 2021

When running model.fit with a class_weight, the kernel crashes before it completes the first epoch.

Steps to reproduce:
Run the tutorial at https://www.tensorflow.org/tutorials/structured_data/imbalanced_data from the beginning of the notebook to cell 35:

weighted_history = weighted_model.fit(
    train_features,
    train_labels,
    batch_size=BATCH_SIZE,
    epochs=EPOCHS,
    callbacks=[early_stopping],
    validation_data=(val_features, val_labels),
    # The class weights go here
    class_weight=class_weight) 

If I comment out class_weight=class_weight, the training runs fine. If I leave it in, it crashes with the following training log:

Epoch 1/100
82/90 [==========================>...] - ETA: 0s - loss: 4.4291 - tp: 60.6707 - fp: 59.4756 - tn: 130275.5366 - fn: 165.3171 - accuracy: 0.9984 - precision: 0.5642 - recall: 0.3115 - auc: 0.7105 - prc: 0.2777

It crashes only on my M1 Mac Mini. If I run the notebook in Colab, it runs fine.

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

No branches or pull requests

1 participant