When I refinished our family room, I installed the trim before the carpet layers came. I cut a few scraps of 1/2" wood, layed them along the wall, set the baseboard on them, and drilled and nailed. I did this all the way around the room so the trim was 1/2" above the floor. This gap allowed the carpeters to put down the 'tack strips', and tuck the excess carpeting underneath the trim.
Now, you COULD wait until the carpet is layed, then put in the trim. Either way, the end-job looks fine. The only problem I had with what I did was the installers used a Tuck Tool (to tuck the carpeting under the trim), and the scratched the heck out of the trim! There were verticle scratches every 1/2" or so. They didn't gouge the wood; they did enough damage to scratch the finish. You can see the damage if you look and I DID tell the retailer. That particular crew was fired (for other reasons apparently soon after) and the next crew installed carpets in 4 bedrooms, a hallway, a stairway, the dining room, and the living room w/o scratching my pre-installed trim. The 2nd crew used a plastic Tuck Tool AND they were careful.
Soooo, you can do what I did but do this. 1) Ask the retailer what the 'proper' heighth is for yor trim for your particular carpet AND padding. (It can vary; mine was 1/2".) 2) Tell the Retailer you want to install the trim BEFORE the carpet. Ask him if the installers will have to scratch the trim to do the 'job'. If so, ask about it, or go to another Retailer. (Like I said, my 2nd crew was able to do the job right with pre-installed trim.) If you need more info, e-mail me directly.
Oh, one more thing. Don't install UNFINISHED trim if you're installing the trim first. You really don't want to be staining / painting / finishing the trim with new carpets just installed! My best to ya and hope this helps.
PS: If you go my route, find a few pieces of wood that are the 'thickness' of the pre-specified height that the trim should be off the floor. That way, you can lay the 'blocks' on the floor and just set the trim on top and not worry about using a ruler.