Introduce TP in coloc mode - #4
Conversation
| self.wake_up() | ||
| llm_model = self.llm.llm_engine.model_executor.driver_worker.model_runner.model | ||
| llm_model.load_weights([(name,weights)]) | ||
| self.llm.sleep(level=2) |
There was a problem hiding this comment.
Once you load weights - you have to stay awake -
correct Pattern:
- wake up - no sleep - so generate - then go back to sleep
|
DO NOT sleep with level 2, it will drop the weight. |
Hello @liguohao96, You're absolutely right: during gradient accumulation,
if (step + 1) % grad_accum_steps == 0:
self.llm.sleep(level=2)But this does not release memory for training, during grad accumulations steps...
|
I tried (1) and got 211.40s/it I tried (2), but got an error while trying to update model from coloc client as follows: I tried (3). This seemed easy, however, as we are not sleeping during ACC steps, this is problematic for OOMs. The key idea of using sleep is to free up memory for training process (especially important for larger models) I tried (4) - and got 181.70s/it. This seems to me as the best option. What do you think @liguohao96 and @fabianlim ? |
|
I use (1) as my current solution. My first thought was sleep level 1 is good enough. |
I believe it's faster because sleep level 2 avoids GPU/CPU transfers, which we suspect are a source of slowdown. Nevertheless, to debug (4), I printed all prompts and generations. Even when I do sleep level 2 only before _move_model_to_vllm, because model will be updated, no need to remember weights—the generations start becoming random.. Because of this, I've also reverted to always using sleep level 1 (approach (1)). |
|
Okay. Another interesing find is that setting My speculation is: generate with |
requirements
git clone https://github.com/huggingface/open-r1.git
pip install -e open-r1
pip install vllm==0.7.3
pip uninstall -y trl
git clone -b tpcoloc https://github.com/toslali-ibm/trl.git
pip install -e trl
cd open-r1
run experiment (Tp=4 for 4 GPUs for 32B model
Qwen/Qwen2.5-14B-Instruct) for vllm coloc tpCUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 accelerate launch \ --config_file recipes/accelerate_configs/zero3.yaml \ --num_processes=8 \ src/open_r1/grpo.py \ --config config.yamlSee the Config.yaml