[Python] Kernel Crashes When Running TensorFlow with Transformers and PEFT Model in Jupyter...

Discussão em 'Python' iniciado por Stack, Dezembro 9, 2024.

  1. Stack

    Stack Membro Participativo

    I am working on a Jupyter Notebook for a project. I'm using TensorFlow and the Transformers library with PEFT for a text-based model. When I run the notebook, the kernel crashes shortly after startup. The logs indicate a TensorFlow-related warning and then terminate without an explicit error message.

    I'm using Windows 10 but running everything in WSL. I installed tensorflow[and-cuda].

    Logs:

    1:37:44.148 [info] Starting Kernel (Python Path: ~/miniconda/envs/tensorflow/bin/python, Conda, 3.12.7) for '/mnt/d/School/Sem-7/Data Challenge/Notebooks/Modelling/Inference.ipynb' (disableUI=true)
    11:37:46.042 [info] Process Execution: ~/miniconda/envs/tensorflow/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
    11:37:46.046 [info] Process Execution: ~/miniconda/envs/tensorflow/bin/python -m ipykernel_launcher --f=/home/~/.local/share/jupyter/runtime/kernel-v38e389ac297194daf06b7d21859329309f3b8ac4a.json
    > cwd: //mnt/d/School/Sem-7/Data Challenge/Notebooks/Modelling
    11:37:46.053 [info] Process Execution: ~/miniconda/envs/tensorflow/bin/python -m pip list
    11:37:46.880 [info] Kernel successfully started
    11:37:46.888 [info] Process Execution: ~/miniconda/envs/tensorflow/bin/python /home/~/.vscode-server/extensions/ms-toolsai.jupyter-2024.10.0-linux-x64/pythonFiles/printJupyterDataDir.py
    11:38:42.560 [error] Disposing session as kernel process died ExitCode: undefined, Reason: 2024-12-09 11:37:51.775306: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
    To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
    2024-12-09 11:37:53.054054: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT


    Code:

    from transformers import AutoModelForCausalLM
    from peft import PeftModel

    base_model = AutoModelForCausalLM.from_pretrained("NousResearch/Llama-2-7b-chat-hf")
    model = PeftModel.from_pretrained(base_model, "BinghamtonUniversity/cs415-llama2-7b-twitch-chats-40k")


    Not sure where to go next.

    Continue reading...

Compartilhe esta Página