I recently started jujitsu which has really opened my eyes concerning weapons. It's very effective against being attacked with weapons (we train with sticks, knives, machetes and guns) but our sensei always says "run if you can". However, it is amazing how many defences end up with you in possession of the opponents weapon.
Your teacher always says "run if you can" because it's
not "very effective" and "amazing" and they know that. It's especially not very effective and amazing for someone who has just started training in it.
It will give you a better chance than no training, but if you over-estimate its effectiveness that might well give you a worse chance than no training.
The best way to use martial arts against someone with a hand to hand weapon (and
especially a bladed one) is to use the strength and fitness it gives you to run faster than your enemy can. Maybe make running away easier by injuring them first if you're already in their range or they've got hold of you, but running away is the key point. That's why any decent teacher will say (and repeat) the message that you should run if you can.
It's different against a ranged weapon, obviously, since they could shoot you as you're running away.