I totally misread your question, but i'll keep this here for a idea later.
If you're using a keg to transfer to another keg pushing with C02, you might could weigh your empty supply 5 gallon keg, then weigh it again when it's full. As you move from 5 gallon keg to the 2.5 gallon keg, stop the transfer when your supply tank reduces by half the weight of it's original volume. The numbers might be slightly skewed with any hoses attached, but I don't think it would be much.
Now to better answer what you asked, lol
Calibrate your glass carboy ahead of time. What I mean is, know how much beer you have for, let's say 1" of fluid. Then after the beer is done, take a ruler and measure the amount of beer that you will be able to rack off the yeast cake then just keep track of how many inches you take out of the carboy.