Will it reflect poorly on me professionally if I would still take the training
Only if you're unprofessional about this when you give notice.
Replacing employees is expensive. It always has direct and indirect costs. The timing of someone's departure can impact this cost in both directions. In your case, the fact that your employer paid for a training they will no longer get a return on investment for is unfortunate. But that's a cost of doing business.
The universal advice when job searching remains to not disclose your search until you have signed or accepted an offer. There are a number of exceptions to this, but you'd know if you were in one. If you have a very good relationship with your manager and they actively push you to succeed and recognise that you've reached a dead end in your current role for instance, it would often be fine to be open about a job search. But even then there are risks involved. If an economic downturn forced your manager to lay someone off, you'd likely be the first out even if your job search would suddenly be much harder.
Which is to say that there are good reasons not to disclose your job search which also means you operate at work as if you're not leaving. This will keep your job secure while also being good in case your job search takes longer than you expect. And that means going to this training. Good employers will know that this is just how this works.
Of course, you do need to acknowledge that the timing is unfortunate. A simple "I realise the timing is poor given that I was just able to attend this training but I got an offer I just couldn't refuse." or some variation on that is all it takes. Under no circumstances should you offer or agree to repay any costs involved. That's not how this works.
If you originally pushed to attend this training, you owe your employer a bit more of an explanation but presumably it still boils down to you wanting to go before realising you might leave. If you pushed for approval even when you were likely already taking interviews then that's a pretty bad look and it can sour the relationship. But the advice remains the same: acknowledge and move on.
I'd also encourage you to read this off-site article by Ask a Manager: should a resigning employee have to reimburse us for costs of a future conference he signed up for?.