2024-03-11|閱讀時間 ‧ 約 24 分鐘

開始LLM DeepLearning之前建議安裝的幾個套件

    建議安裝minianaconda或是anaconda後建立一個虛擬環境(如果你熟悉docker也很建議用docker來進行作業)
    底下套件也都不是絕對必要,只是建議裝一裝。

    pip install pandas
    pip install numpy
    pip install scikit-learn
    pip install matplotlib
    pip install cmake
    pip install jupyter


    vllm:

    https://github.com/vllm-project/vllm?tab=readme-ov-file
    pip install vllm (12.1) <= 12.1的跑這行,其他版本可以參考官網或底下

    # Install vLLM with CUDA 11.8.
    export VLLM_VERSION=0.2.4
    export PYTHON_VERSION=39
    pip install https://github.com/vllm-project/vllm/releases/download/v${VLLM_VERSION}/vllm-${VLLM_VERSION}+cu118-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}-manylinux1_x86_64.whl

    # Re-install PyTorch with CUDA 11.8.
    pip uninstall torch -y
    pip install torch --upgrade --index-url https://download.pytorch.org/whl/cu118

    # Re-install xFormers with CUDA 11.8.
    pip uninstall xformers -y
    pip install --upgrade xformers --index-url https://download.pytorch.org/whl/cu118


    pytorch:

    到這邊可以方便你快速的安裝 
    https://pytorch.org/get-started/locally/
    到這邊可以選擇舊的版本
    https://pytorch.org/get-started/previous-versions/
    例如:

    pip install torch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu121


    測試是否安裝成功

    import torch
    torch.cuda.is_available()
    ==>True就是有支援

    import torch
    x = torch.rand(2,4)
    print(x)

    ===================================
    tensor([[0.2101, 0.5285, 0.9225, 0.4756],
    [0.1439, 0.1285, 0.1951, 0.4476]])
    ===================================


    XFormers:

    pip uninstall ninja -y && pip install ninja -U
    pip install -U xformers --index-url https://download.pytorch.org/whl/cu118



    分享至
    成為作者繼續創作的動力吧!
    © 2024 vocus All rights reserved.