[batch, 1, length_of_spectra]
is the correct shape for 1D convolution. Normalization and regularization is the proper way too.
Regarding your loss becoming NaN
after a while, try applying this function to your model before you update weights
def sanitize_grads(module):
for param in module.parameters():
if param.grad is not None:
torch.nan_to_num(param.grad, nan=0, posinf=1e5, neginf=-1e5, out=param.grad)