Training robust and generalizable quantum models