File size: 2,146 Bytes
2b95ff4 4b0a7d0 993c43e 09b6703 993c43e 2b95ff4 09b6703 2b95ff4 993c43e 2b95ff4 993c43e 2b95ff4 09b6703 993c43e 09b6703 2b95ff4 993c43e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | # Plan_Q-RAG
## Setup Rent GPU
```
parent_dir/
├── Q-RAG/ ← [Q-RAG](https://github.com/griver/Q-RAG.git)
└── datasets/ ← [datasets Hotpotqa and Musique](https://huggingface.co/datasets/Q-RAG/Hotpotqa_and_Musique)
```
### Git datasets for Q-RAG
```bash
git clone https://huggingface.co/datasets/Q-RAG/Hotpotqa_and_Musique
cd Hotpotqa_and_Musique
unzip hotpotqa+musique.zip -d /workspace/datasets
cd ..
rm -rf Hotpotqa_and_Musique
du -h
```
### Git repo of Q-RAG
```bash
git clone https://github.com/griver/Q-RAG.git
cd Q-RAG
#Only need when you don't have your self-trained hotpotqa model yet
git clone https://huggingface.co/Q-RAG/qrag-ft-e5-on-hotpotqa
```
### Environment Setup
```bash
# Setup venv
conda create -n qrag python=3.12 -y
conda activate qrag
python -m pip install -U pip wheel
pip install vllm # pulls compatible PyTorch, Transformers, Triton, etc.
pip install hydra-core tensorboard rotary-embedding-torch pandas nltk sortedcontainers accelerate datasets
# Check environment
python -c "from rl.agents.pqn import PQNActor; print('✅ Q-RAG installed successfully')"
```
### Train: Log with Time
```bash
python train_q_rag_logt.py \
envs=hotpotqa \
algo=pqn_e5_hotpotqa \
envs.data_path="/workspace/datasets/hotpotqa" \
steps_count=10000 \
batch_size=12 \
accumulate_grads=8 \
eval_interval=50 \ #original 100
envs_parallel=1 \
max_action_length=220
```
### Original Train
```bash
python train_q_rag.py \
envs=hotpotqa \
algo=pqn_e5_hotpotqa \
envs.data_path="/workspace/datasets/hotpotqa" \
steps_count=10000 \
batch_size=12 \
accumulate_grads=8 \
eval_interval=100\
envs_parallel=1 \
max_action_length=220
```
## Computer resources
[基于HotpotQA+Musique(combined, GTE embedder) 训练出来的模型](QRAG_combined.zip) Q-RAG文中没有提及他的测试 <br>
- 训练时常:18:07:48
- 显卡: Pro 6000 96GB
- 显存占用:60GB ± 0.5GB

HotpotQA_推理
- 训练时常:00:12:26
- 显卡:NVIDIA A100-SXM4-80GB
- 显存占用:30GB ± 1GB
 |