Resistor Value for controlling 5V relay
Start with the pull up, that must be low enough resistance that the output can provide enough current to send a high signal.
the next resistor is the pull down on the base, that must be low enough that the transistor stays off when it should be off, even when it's hot.  100K is usually plenty low enough, but 10K works here too.
The final resistor is the base resistor that needs to be low enough to provide enough current to turn the transistor on when the base is at 0.7V and to provide current through the pull down.
In switching circuits it's customary to assume a current gain of 10, so, if the pull up passes 500uA, 50uA is needed in the transistor base, and another 70uA to feed the pull-down resistor.
so it's 120uA
The Raspberry Pi outputs promise about 3V for high so 120uA from 2.3V difference means  19K or less will work here...
For some reason they chose 2K instead of just using another 10K resistor.  Perhaps the output needs to accept more than the current from the pull-up resistor.
That would mean more current through the transistor and thus more needed into the base.