Closed zhimin-z closed 1 year ago
Could you track at what piece of code it crashes? That would make it much easier to figure out what is happening. Also, make sure to have a pytorch version installed that works for M2.
@MaartenGr I found out it crashed when I execute embedding_model = SentenceTransformer("all-mpnet-base-v2")
. But when I tried with:
import torch
x = torch.rand(5, 3)
print(x)
It indeed works as expected:
tensor([[0.9452, 0.9088, 0.9812],
[0.1468, 0.4544, 0.8565],
[0.6701, 0.7626, 0.1618],
[0.1539, 0.1461, 0.1831],
[0.7187, 0.3056, 0.4588]])
Also when I delete embedding_model
from BerTopic and fit with my data, it also immediately crashed. The crash always happens even when I use BerTopic without any custom configuration: BERTopic().fit(docs)
. My dataset is just 2MB.
I am using Python 3.9.13
and bertopic==0.14.0
. I tried to downgrade to bertopic==0.13.0
, no luck still crashed.
Any other suggestion perhaps?
This is log from Jupyter:
[W 01:34:00.620 NotebookApp] Unhandled error
warn 01:34:00.624: Error occurred while trying to start the kernel, options.disableUI=true Ap [Error]:
at new pn (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:2:1628691)
at new Ap (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:17:127546)
at /Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:17:278397
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Unhandled error
at Function.create (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:2:68927)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Object.t.startSession (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:2:81011)
at d.startNew (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:2:77195) {
category: 'unknown',
originalException: t [Error]: Unhandled error
at Function.create (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:2:68927)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Object.t.startSession (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:2:81011)
at d.startNew (/Users/jimmy/.vscode/extensions/ms-toolsai.jupyter-2023.1.2010391206/out/extension.node.js:2:77195) {
response: L [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: [Object],
[Symbol(Response internals)]: [Object]
},
traceback: '',
vslsStack: [ CallSite {}, CallSite {}, CallSite {}, CallSite {} ]
}
}
I deploy the same script in Docker, and crash did not happen:
FROM python:3.9.13
COPY . .
RUN pip3 install -r requirements.txt
CMD ["python", "main.py"]
Since Docker default OS is Linux rather than MacOS, I wonder if this is due to incompatible issues caused by M2 chip?
@zhimin-z The issue might indeed be caused by the M2 chip. However, I believe that there is now GPU support for ARM-based Mac processors (M1 & M2) in PyTorch, so making sure you have the right version of PyTorch here would be key.
Due to inactivity, I'll be closing this issue. Let me know if you want me to re-open the issue!
I am running bertopic on my Mac Air laptop (M2, 16GB) but it 100% crashed:
Here is the log message:
Did anyone get an idea why this always happens? I appreciate it in advance! BTW, the same code never crashed on my Windows 10 PC (i7-4790, 16GB, GTX 745). Does it have anything to do with GPU/CUDA? @MaartenGr Do you have any idea?