| set -euo pipefail | |
| # 1) Sistem | |
| sudo apt-get update | |
| sudo apt-get -y install python3 python3-venv python3-dev build-essential git wget curl tmux htop nvtop | |
| # 2) CUDA 12.1 (Ubuntu 22.04) | |
| wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb | |
| sudo dpkg -i cuda-keyring_1.1-1_all.deb | |
| sudo apt-get update | |
| sudo apt-get -y install cuda-toolkit-12-1 | |
| if ! grep -q "/usr/local/cuda/bin" ~/.bashrc; then | |
| echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc | |
| echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc | |
| fi | |
| # 3) Python venv + PyTorch cu121 | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| pip install --upgrade pip | |
| pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 | |
| # 4) Proje bağımlılıkları | |
| cat > requirements.txt <<'REQ' | |
| transformers>=4.41 | |
| sentencepiece>=0.2.0 | |
| tqdm>=4.66 | |
| accelerate>=0.30 | |
| huggingface-hub>=0.23 | |
| bitsandbytes>=0.43 | |
| hf_transfer>=0.1.6 | |
| datasets>=2.19 | |
| gpustat>=1.1 | |
| nvitop>=1.3 | |
| REQ | |
| pip install -r requirements.txt | |
| # 5) Doğrulama | |
| python - << 'PY' | |
| import torch | |
| print("cuda?", torch.cuda.is_available(), "gpus=", torch.cuda.device_count()) | |
| for i in range(torch.cuda.device_count()): | |
| print(i, torch.cuda.get_device_name(i)) | |
| PY | |
| echo "OK - Kurulum bitti. 'source venv/bin/activate' ve eğitim komutuna hazırsın." |