You can use enzyme-based cleaners to break down odor-causing molecules or a mixture of baking soda and essential oils sprinkled over the carpet, left overnight, and vacuumed up the next day.