(Really it's moldy carpet backing and carpet pad, that is the problem. That's why shampooing doesn't help.)
Start with the landlord. Moldy carpet can give you respiratory problems, and shampooing it is not going to help. If all the landlord offers to do is to shampoo it, get his refusal in writing. Then tell him you are going to get the air tested, and that if there are dangerous pathogens in it, you will expect to be let out of the lease. (It would be grounds for getting out of your lease.) If you have to, take the matter to an attorney. If the landlord has not fixed the problem and you have had to pay for an air quality test to prove it, the attorney should be able to get you out of your lease, get his fees from the landlord, and get the cost of the testing from the landlord as well. Tell the landlord that is would be a lot cheaper just to let you out of the lease than to have to cough up all of that.