ai - llama factory的安装和使用
访问量: 8
refer to: https://github.com/hiyouga/LlamaFactory
git clone
cd ..
先查看显卡的硬件:$ nvidia-smi
Sun Mar 29 13:19:54 2026 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 576.88 Driver Version: 576.88 CUDA Version: 12.9 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Driver-Model | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA GeForce RTX 3080 WDDM | 00000000:04:00.0 On | N/A | | 50% 44C P8 17W / 320W | 3156MiB / 20480MiB | 12% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+
pip install -e . -i https://mirrors.aliyun.com/pypi/simple/
pip install -r .\requirements\metrics.txt -i https://mirrors.aliyun.com/pypi/simple/
对于windows,还需要:
pip uninstall torch torchvision torchaudio
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
python -c "import torch; print(torch.cuda.is_available())"
需要返回True
windows用户:安装 bitsandbytes
具体需要下载的版本号参考:https://www.doubao.com/thread/wa26102ff5387b63e
我的是3080, 20G, 所以使用了这个:(最新的)
这里比较折腾。 参考:https://www.doubao.com/thread/w1fee0eccea95cfa9
pip uninstall -y numpy torch bitsandbytes
pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
pip install C:\Users\你的用户名\Desktop\bitsandbytes-0.41.2.post2-py3-none-win_amd64.whl
验证:
python -c "import numpy; import torch; import bitsandbytes; print('环境正常!NumPy:',numpy.__version__,'CUDA:',torch.version.cuda)"