Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.6.1-1 causing issues on M1 #590

Closed
ImolaS3 opened this issue Feb 21, 2023 · 4 comments
Closed

3.6.1-1 causing issues on M1 #590

ImolaS3 opened this issue Feb 21, 2023 · 4 comments

Comments

@ImolaS3
Copy link

ImolaS3 commented Feb 21, 2023

I was prompted to update to 3.6.1 on my M1 mac and now I can't run several programs that previously worked fine, and they still work on my intel mac running 3.6.1

The code starts to process and after a few seconds, I get an error "Kernel Restarting The kernel appears to have died. It will restart automatically"

This is on code that ran fine before the update

if it helps, one of the programs giving this errors is:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # hide info and warning messages from tensorflow, but not errors
from tensorflow import keras
from keras import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten
import numpy as np
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt

data = pd.read_csv('/Users/antonysutton/My Drive/Documents/Design_and_analysis/Data sets/handwritten data set/A_Z Handwritten Data.csv')

feature = data.iloc[:, data.columns != '0'].values
label = data[data.columns[0]].values

x_train, x_test, y_train, y_test = train_test_split(feature, label, test_size=0.2)
x_train = np.array(x_train)
y_train = np.array(y_train)
x_test = np.array(x_test)
y_test = np.array(y_test)

print(x_train.shape)

x_train = x_train.reshape(x_train.shape[0], 28, 28, 1)
x_test = x_test.reshape(x_test.shape[0], 28, 28, 1)
x_train = x_train / 255.
x_test = x_test / 255.

print(x_train.shape)

model = Sequential([
Conv2D(64, (5, 5), input_shape=(28, 28, 1), activation="relu"),
MaxPooling2D(pool_size=(2, 2)),
Dropout(0.25),
Conv2D(32, (5, 5), input_shape=(28, 28, 1), activation="relu"),
MaxPooling2D(pool_size=(2, 2)),
Dropout(0.25),
Flatten(),
Dense(64, activation='relu'),
Dropout(0.4),
Dense(26, activation='softmax'),
])

model.compile(
optimizer=keras.optimizers.Adam(learning_rate=0.001),
loss=keras.losses.SparseCategoricalCrossentropy(),
metrics=[keras.metrics.SparseCategoricalAccuracy()]
)

model.fit(x_train, y_train, epochs=20, batch_size=64, validation_data=(x_test, y_test))

def show_example(index, preds, dsx, dsy):
current_img = dsx[index][:, :, 0] * 255
prediction = np.argmax(preds[index])
if(len(dsy) > 0 or dsy != None) :
label = dsy[index]
print("Label:", label)
print("Prediction:", prediction)
plt.imshow(current_img, interpolation='nearest', cmap='gray')
plt.show()

show_example(9, preds, x_test, y_test), show_example(23, preds, x_test, y_test)

def analysis(preds, limit, dsx, dsy):
correct = 0
misclassified = []
for i in range(limit):
prediction = np.argmax(preds[i])
label = dsy[i]
if(prediction == label):
correct += 1
else:
misclassified.append(i)

print(f"Predictions in a limit of {limit} are {(correct / limit) * 100} correct")
print(f"Misclassfied {len(misclassified)} examples:")
for i in misclassified:
    show_example(i, preds, dsx, dsy)

preds = model.predict(x_test)
analysis(preds, x_test.shape[0], x_test, y_test)

def predict(filepath, submitfile):
X_test = pd.read_csv(filepath) # 测试数据存放于 test.cv

X_test = X_test.to_numpy()
X_test = X_test.reshape(X_test.shape[0], 28, 28, 1)
X_test = X_test / 255.
preds = model.predict(X_test)
labels = [np.argmax(i) for i in preds]
idxs = [i+1 for i in range(len(labels))]
submit = pd.DataFrame({'ImageId': idxs, 'Label': labels})  # 格式
submit.to_csv(submitfile, index=False)
@welcome
Copy link

welcome bot commented Feb 21, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@JasonWeill JasonWeill added the bug label Feb 23, 2023
@JasonWeill
Copy link

What version of JupyterLab Desktop were you previously using on your M1 Mac?

On your M1 Mac, if you uninstall JupyterLab Desktop and install version 3.6.1-1 again, do you still see this problem? I'm curious about whether this is a bug with the upgrade flow.

@JasonWeill
Copy link

@ImolaS3 Can you provide the info requested above, please?

@JasonWeill
Copy link

Without the info requested above, it's not possible to reproduce and diagnose this bug. Closing this for now; please reopen with the requested information. Thanks!

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

No branches or pull requests

2 participants