- Newest
- Most votes
- Most comments
I tried importing the packages one-by-one from python command line. And, I found, this is the line that is causing python to crash:
from transformers import AutoProcessor
Error message is:
ERROR: Flag 'minloglevel' was defined more than once (in files 'src/error.cc' and 'home/conda/feedstock_root/build_artifacts/abseil-split_1720857154496/work/absl/log/flags.cc').
This is discussed in this SO question.
The issue has to do with an incompatible version of sentencepiece
package.
I downgraded the package:
pip install sentencepiece==0.1.99
Now, I'm able to import all packages.
The issue you're experiencing with the Jupyter kernel dying when importing torch in a notebook, while it works fine in a terminal, could be due to several factors. Here are some steps you can take to debug and potentially resolve the issue:
-
Check kernel logs: Look for any error messages or stack traces in the Jupyter kernel logs. These logs might provide more detailed information about why the kernel is crashing.
-
Verify memory usage: The ml.g4dn.2xlarge instance has 32 GB of RAM. Ensure that you're not running out of memory when importing torch. You can monitor memory usage using system tools or within your notebook.
-
Update PyTorch: Make sure you're using the latest compatible version of PyTorch. You can try updating it using pip:
pip install --upgrade torch
-
Check CUDA compatibility: Ensure that the CUDA version installed on your instance is compatible with your PyTorch version.
-
Restart the Jupyter kernel: Sometimes, simply restarting the kernel can resolve issues.
-
Create a new conda environment: Try creating a fresh conda environment with only the necessary dependencies and see if the issue persists.
-
Use a different kernel: Try using a different kernel, such as the Python 3 (Data Science) kernel, which comes pre-configured with many data science libraries.
-
Increase instance size: If the issue persists, you might want to consider using a larger instance type with more memory and compute resources.
-
Contact AWS Support: If none of the above steps resolve the issue, it might be worth reaching out to AWS Support for further assistance.
Remember that memory leaks can occur in Jupyter notebooks, especially when working with large datasets or complex models. It's a good practice to restart your kernel periodically and run garbage collection to free up memory.
If the problem continues, you might want to consider using SageMaker Studio instead of a standalone Jupyter notebook instance, as it offers more flexibility in terms of resource allocation and kernel management.
Sources
Set the Notebook Kernel - Amazon SageMaker
Machine Learning Service – Amazon SageMaker Studio Notebooks – AWS
Is there a memory leak with Sagemaker Jupyperlab python kernel? | AWS re:Post
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago