i want sending 3 parallel in 1 second
- User
i want sending 3 parallel in 1 second
- Assistant
To run 3 commands in parallel every 1 second, use this Bash script:
1. Create
modelnames.txtwith your model names (one per line).model1 model2 model3 model4 model52. Create
run_parallel.sh:#!/bin/bash models=( $(<modelnames.txt) ) for ((i=0; i < ${#models[@]}; i+=3)); do # Run 3 models in parallel for ((j=0; j < 3; j++)); do model="${models[i+j]}" [ -z "$model" ] && break python model.py --model="$model" & done wait # Wait for current batch to finish sleep 1 # Wait 1 second before next batch done3. Make it executable and run:
chmod +x run_parallel.sh ./run_parallel.sh
Explanation:
&runs commands in the background (parallel).waitensures all 3 commands in the current batch finish before proceeding.sleep 1enforces a 1-second delay between batches.
Bonus: Using GNU Parallel (simpler):
If you have GNU Parallel installed:
parallel -j 3 --delay 1 python model.py --model={} :::: modelnames.txt-j 3: Run 3 jobs in parallel.--delay 1: Wait 1 second between batches.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.