The best way to get rid of this smell is not to smoke marijuana at all, lol. Use high quality CBD gummies or other stuff like that. It doesn't smell. More serious - try to use vinegar for your carpet. Yes, it smells terrible, but vinegar is the best way to deal with any smell. I used it several times when my cat pissed on my carpet. And it really helped. Also, you can just take it on the street and hang it on a clothesline, if you have enough time. If you don't - use vinegar. That's that.
The Best way to get marijuana smell out is not to use marijuana. For example, I use CBD oil and am happy with that. It helps me deal with severe back pain, that appears after the injury I had. So I buy CBD oil on the Internet, and in case you are interested you can visit https://www.healthcanal.com/best-cbd-oil/arthritis, I can really recommend you this website. So CBD oil is quite affordable so you need to try it, in case you want to avoid situations with the smell, because the marijuana smell can be a problem.