When is a tenant responsible for replacing carpet?

When damage exceeds what the law calls 'ordinary wear and tear'

Since tenants' interests in real property are not vested, the opinion of the landlord carries the most weight in such a determination.