From reading about this kinda situation, even cooking will not kill all kinds of mold, and those spores can be so microscopic that filtering it would be futile.

I guess if you still wanna try to use it, the best you can do is try to cut off all of the affected areas (and then some) and throw away the moldy spots. And leave it out in a warm place to dry for a couple days to get rid of any extra moisture. If you're not ready to use the buds then throw them into the freezer so more mold doesn't grow.

For your own safety, I still wouldn't advise you to use the good parts of the weed that was infected since it can be on it's way to growing mold but looks fine to the naked eye. As for any weed stored in the same container that looks like it's still good, put it on ice or use it up... chances are they will soon meet their doom as well.