You should go by feel when pyramiding up with warm-up sets. This encompasses weight selection, how big you want your weight jumps to be, how many reps to perform. You shouldn’t take your warm-up sets to failure.
For the sake of efficiency, work-sets should be taken to an RIR (reps in reserve) of 0-1 (arguably, 2 should be fine).
I generally perform ~5 warm-up sets for big compound exercises like barbell back squats. ~3 warm-up sets for smaller isolation exercises like curls.
After the first exercise for the body part I’m training that day, I usually only perform 1 warm-up set for all subsequent exercises for that same body part.
YMMV.