The carpet is going to be at least 90% of the problem, just replace it, then get somebody in for duct cleaning and/or replacement.
When we moved into our rental, the previous owners had 2 or 3 large dogs. Even after cleaning the place and steam cleaning the carpet, it smelled like dog. Had the carpet replaced and it smelled like, well, nothing.
The ducts probably won’t hold any dog smell or dog allergen since there are filters (presumably) in place before the return air hits the ducts, but they may have dust, mites, mold, etc.