| #!/usr/bin/env bash |
| set -euo pipefail |
|
|
| cd "$(dirname "$0")/.." |
|
|
| python3 -m venv .venv |
| source .venv/bin/activate |
|
|
| python -m pip install -U pip wheel setuptools |
| python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 |
| python -m pip install -U \ |
| numpy pandas pyarrow polars scipy scikit-learn \ |
| tqdm pyyaml orjson jsonlines regex \ |
| transformers accelerate bitsandbytes \ |
| sentencepiece protobuf safetensors tokenizers \ |
| huggingface_hub datasets peft sentence-transformers |
| python -m pip install -U faiss-cpu pyserini rank-bm25 |
|
|
| python - <<'PY' |
| import sys |
| print("python:", sys.version) |
|
|
| import torch |
| print("torch:", torch.__version__) |
| print("cuda:", torch.version.cuda) |
| print("cuda available:", torch.cuda.is_available()) |
| if torch.cuda.is_available(): |
| print("gpu:", torch.cuda.get_device_name(0)) |
| print("capability:", torch.cuda.get_device_capability(0)) |
| print("memory GB:", torch.cuda.get_device_properties(0).total_memory / 1024**3) |
| print("bf16 supported:", torch.cuda.is_bf16_supported()) |
|
|
| import transformers, accelerate |
| print("transformers:", transformers.__version__) |
| print("accelerate:", accelerate.__version__) |
|
|
| try: |
| import bitsandbytes as bnb |
| print("bitsandbytes:", bnb.__version__) |
| except Exception as e: |
| print("bitsandbytes import error:", type(e).__name__, e) |
| PY |
|
|
| echo "ML environment ready. Activate with: source .venv/bin/activate" |
|
|