Humping is usually caused by anxiety or over-excitement. Give them some calm time to settle, for example by sending your puppy or dog to their time-out spot, ensuring there are no nearby toys, and ignore them. If after a few minutes your puppy hasnt tried mounting again, provide them with positive feedback, for example a treat or praise.