Will a loss on securities or crypto be permitted to offset early withdrawal penalties?

I have significant (for me) losses from stocks and cryptocurrency. If I have an early retirement account withdrawal, I know there is a 10% penalty.   Will my losses count toward reducing my total taxes regardless of the penalties? 

My thinking is that since I already have taken the losses, in early 2022, if I do an early withdrawal from a 457b plan and have the ten percent penalty, that penalty will in effect be reduced by my losses. Is that correct?

 

 I am weighing my options, have not done it yet. Please try and refrain from insisting its a horrible idea to withdraw from the retirement accounts, because that will only happen if absolutely necessary! 

Thanks!